Reply to Re: list files from directory on a site

Your name:

Reply:


Posted by Martin Jay on 05/04/06 20:03

In message <4bunlmF1367ahU1@individual.net>, chlori <usenet314@arto.ch>
writes

>I would like to have a list of links on a website linking to the files in
>a given directory (each file has one link). This list should get updated
>when the files from that dir are edited (files added, removed, renamed,
>...) with a separate FTP-client. Is that possible?

Yes, and quite easy to do. Some web servers will display a list of all
files in a directory if that directory doesn't contain an 'index' file.

If you can run PHP files on your server you could use something like
this:

<?php

$dir=""; // Directory where files are stored

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>

--
Martin Jay

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация