kamranki Posted December 21, 2006 Share Posted December 21, 2006 Hello everyone,Since I'm a complete beginner, please excuse any errors or mistakes. I don't have any scripting experience to speak of but I mostly manage by copy and pasting. In most conditions, I am able to understand the syntax.I have set up a simple webserver for uploading files. It can be accessed at:[url=http://www.kamranki.com:1300/upload/user/upload.php]http://www.kamranki.com:1300/upload/user/upload.php[/url]The webserver machine uses the following:- Windows XP Professional SP2- Abyss Web Server X1 - PHPI would like to list local folders and their contents on the webpage so that I can access my files from anywhere. I already have an FTP server running but I would also like to access my files through HTTP. I don't need a complex setup but rather a very simple listing of files from a specific folder on the hard drive. I should be able to download the file by clicking on it's name.I would like to know if there's a function for listing files from local folders. Any examples will do just fine. Any help would be greatly appreciated.Thanks and regards,Kamran Quote Link to comment Share on other sites More sharing options...
trq Posted December 21, 2006 Share Posted December 21, 2006 Ive never heard of Abyss web Server but apache has a directive which allows you to list file indexes, maybe Abyss does too.Of course if you want to display files from outside of the web root, then your going to need to write a script to do it. In which case your going to want to find a tutorial on reading directories with php.[url=http://hudzilla.org/phpwiki/index.php?title=Working_with_files]Here[/url] might also be a good place to start. Quote Link to comment Share on other sites More sharing options...
kamranki Posted December 21, 2006 Author Share Posted December 21, 2006 Yes Thorpe, you got it right. I want to display files from outside of the root. For example, files and folders from various different partitions. Quote Link to comment Share on other sites More sharing options...
kamranki Posted December 25, 2006 Author Share Posted December 25, 2006 Here's what I was able to manage; a simple listing of contents of c:\temp on the PC. But how can I make these files downloadable? I tried looking at some other sample scripts from around the web but was unable to get anything working. :-[Following are the contents of download.php:[hr][font=Courier]<font face="Tahoma" size="2" color="black"><?phpif ($handle = opendir('c:\\temp')) {while (false !== ($file = readdir($handle))){ if ($file != "." && $file != ".."){ echo "$file <br>"; }}}?>[/font][hr]It can be accessed at:[url=http://www.kamranki.com:1300/download/files/download.php]http://www.kamranki.com:1300/download/files/download.php[/url] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.