You are here: Re: list files from directory on a site « HTML « IT news, forums, messages
Re: list files from directory on a site

Posted by Martin Jay on 05/05/06 02:10

In message <4bvcqkF13n9qfU1@individual.net>, chlori <usenet314@arto.ch>
writes
>Martin Jay wrote:
>> 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);
>> }
>> ?>
>
>I get an "Internal Server Error". Any ideas?
>
>Is there some server config stopping it from working or am I doing
>something wrong?

Hmmm, I haven't seen that non-specific error since my Perl days. :)

There may be some more useful information in your log.

Perhaps '$dir' hasn't been set correctly. For example: my domain name
is spam-free.org.uk, but my host stores my files at:

/homepages/0/[REMOVED]/htdocs/spam-free.org.uk/

I've upload the full .php file to:

http://www.spam-free.org.uk/pages/dir.zip

And this is the sort of output you should get form it:

<http://www.spam-free.org.uk/pages/dir/>

--
Martin Jay

 

Navigation:

[Reply to this 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

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