Jump to content


Photo

Directory Listing


  • Please log in to reply
2 replies to this topic

#1 akrytus

akrytus
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 09 August 2006 - 01:15 PM

Perhaps I expect to much, but is it possible to create a webpage that works like an index?  List all the directories and files and be able to click on a directory to browse it and to click on a file to download it while all being held in a scroll box within the page to keep the page from having to scroll?  Any sample code or ideas would be appreciated.  Thanks!

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 09 August 2006 - 02:00 PM

indeed you can do this - its not too difficult...

you will need to know opendir(), readdir(), closedir().

loop through the directory using read_dir() if its a directory then gen a link to run script again with the new directory the root folder its looking in, if a file generate a link to download/view.

as far as the html goes...

<div style="height: 400px; over-flow: auto;">
//stick you links in here...
</div>
follow me on twitter @PHPsycho

#3 akrytus

akrytus
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 09 August 2006 - 02:19 PM

Sounds good, but how do you create a script that would run on a mouse click to change the dir.  I would naturally try to have the php chr_dir command run on a java onClick but, I have found the php will run immediately without the java script running first.  Do you have an idea how I can get the script to run on the click, without using a form?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users