Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Website File Navigation System???
Old 10-17-2007, 01:17 AM Website File Navigation System???
Average Talker

Posts: 24
Trades: 0
I'm not exactly sure where to post this. I need a simple way to achieve what I need....

This should be really simple but I cannot figure it out! I need to have a webpage on my website that shows a couple of folders on my server, and then when you click on those folders, all the files that are inside the particular folder will appear (without me having to make hyperlinks for each one). I don't need a script or code that uploads to the server....I can upload the files no problem. I DO need a way for web guests to be able to view the documents (such as .doc or .pdf) that are in each folder. Please give me a SIMPLE way to accomplish this file navigation system. Thanks so much. I truly appreciate it! :-)
CookieMonster21 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-17-2007, 03:34 AM Re: Website File Navigation System???
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And the server side code this needs to be in is ????
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-17-2007, 02:46 PM Re: Website File Navigation System???
Average Talker

Posts: 24
Trades: 0
Chris,

Um, good question....I am a novice at this part. :-) I like easy things like html but I can follow how to implement other types of scripts and codes if there are directions to follow. I just need something simple and basic. I need the website guest to click on a page, see a few folders shown on the page, and then be able to see the contents of those folders. Simple; right? :-) Thanks for any advice you can give me. I use Go Daddy hosting if that helps tell you what is all on my server.
CookieMonster21 is offline
Reply With Quote
View Public Profile
 
Old 10-19-2007, 11:35 AM Re: Website File Navigation System???
w2i
Average Talker

Posts: 27
Trades: 0
Maybe something like this?

PHP Code:
<?PHP

function show_dir($dir$pos=2)
{
    if(
$pos == 2
    {
        echo 
"<hr><pre>";
    }

    
$handle = @opendir($dir);
    while (
$file = @readdir ($handle))
    {
        if (
eregi("^\.{1,2}$",$file) || ($file == ".htpasswd")  || ($file == ".htaccess") || ($file == "index.php"))
        {
            continue;
        }

        if(
is_dir($dir.$file))
        {
            
printf ("% ".$pos."s <b>%s</b>\n""|-"$file);
            
show_dir($dir.$file."/"$pos 3);
        }
        else
        {  
$kb 1024;
           
$mb $kb 1024;

           
$sof filesize($dir.$file);

           if (
$sof $kb) {
               
$sizeOfFile $sof " Byte";
           }
           if (
$sof >= $kb) {
               
$sizeOfFile sprintf("%.1f",$sof/$kb) . " KByte";
           }
           if (
$sof >= $mb) {
               
$sizeOfFile sprintf("%.1f",$sof/$mb) . " MByte";
           }

            
printf ("% ".$pos."s %s\n""|-""<a href=\"" $dir.$file "\">" $file "</a> (" .$sizeOfFile ")");
        }
    }
    @
closedir($handle);

    if(
$pos == 2)
    {
        echo 
"</pre><hr>";
    }

}

show_dir("./");

?>
w2i is offline
Reply With Quote
View Public Profile
 
Old 10-19-2007, 12:45 PM Re: Website File Navigation System???
blue-dreamer's Avatar
King Spam Talker

Posts: 1,222
Location: Middle England
Trades: 0
You can also do this with .htaccess if you're host supports it

1. Open up Notepad
2. Add this line...

Options +Indexes

3. Save the file as .htaccess
4. Upload to the folder where your files are

See http://www.rixort.com/tutorials/apache-htaccess.php for reference.
blue-dreamer is offline
Reply With Quote
View Public Profile
 
Old 10-19-2007, 07:47 PM Re: Website File Navigation System???
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Sounds like all you need is to allow directory browsing?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-20-2007, 03:42 AM Re: Website File Navigation System???
Average Talker

Posts: 24
Trades: 0
Thanks to all of you for these responses. It is looking like the place that hosts my site has some overriding setting, so hopefully they can direct me how to correct it. If I need more help on it, I'll be back. But thank you so much. I will keep all your responses for future reference. Thanks! :-)
CookieMonster21 is offline
Reply With Quote
View Public Profile
 
Old 10-20-2007, 02:45 PM Re: Website File Navigation System???
Experienced Talker

Posts: 45
Trades: 0
Directory browsing works and there are even ways to customish the look and contents, look up any apache tutorial on that.
I would however reccomend something like the php code suggested above by w2i. Basically just print the files in the directory and you can skip any you don't want like error.txt or something, and control full html of the page.
__________________
-sites/domains i have-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
-
accesstimes is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Website File Navigation System???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28569 seconds with 12 queries