Forums
This topic is locked
Automatically update links to files in specific fo
Posted 29 Nov 2007 20:51:40
1
has voted
29 Nov 2007 20:51:40 Stefan Georgiev posted:
I found the posting I'm attaching below in other forum. My situation is the same, but i need the code in ASP.Can someone help here???
Here is the posting:
--------------------------------------------------------------------------------
I run a webserver on my home PC, I would like to know (if it's Possible) how I can make a personalized home page (index.html) that will update itself with links to files in a specified folder. E.g. If I copy an new file or remove a file from a download folder I would like the index.html to automatically detect the changes and update the links automatically. I would like to acomplish this with simple html if possible as I don't understand .php and well any other formats to tell the truth.
Thanks
--------------------------------------------------------------------------------
The PHP code you want is:
<?php
$dirname = '/var/www/download_folder'; // adjust as needed, such as 'C:\web_root\download_folder' for Windows
$webdirname = '/download_folder'; // what the directory appears as from the web browser's point of view
$dir = opendir($dirname);
$file_list = '';
while(($file = readdir($dir)) != false) {
if(($file != '.') && ($file != '..')) {
$file_list .= "<a href=\"$webdirname/$file\">$file</a><br/>";
}
}
closedir($dir);
?>
<p>
<?=$file_list?>
</p>
That should list all the files in $dirname as links to them.
You will, as ever, need PHP installed on your webserver.
--------------------------------------------------------------------------------
thanks, That worked like a charm
Replies
Replied 26 Dec 2007 15:32:54
26 Dec 2007 15:32:54 dave blohm replied:
I've used FileGenie (which I bought from dmxzone) and if I understand what you are looking for, this extension is what you need.
Hope this helps.
- Doc
Progress is made by the discontent.
Hope this helps.
- Doc
Progress is made by the discontent.