PHP problem

They have: 2 posts

Joined: May 2008

i have solved this problem i need to put a special icon for each type of file how i must do it?i did it for directory

<?php
echo "<form method=post>";
echo
"<input type=text name=dirname>";
echo
"<input type=submit value='Show file' name=knopka>";
echo
"</form>";


$d=opendir($_REQUEST[dirname]);






while ( (
$str=readdir($d))!=NULL ) {


if (
is_dir("$_REQUEST[dirname]".$str) ) { echo "<img src=folder.bmp> $str";}




echo
"<br>";
}








closedir($d);
?>

dk01's picture

He has: 516 posts

Joined: Mar 2002

Welcome to the forums!

Probably the easiest way is to use a premade script (for security's sake). If you'd like to do this, check out CeleronDude's Indexer 2.0 Script here:

http://www.celerondude.com/downloads/indexer20.zip

And for a demo of the output go here:
http://www.celerondude.com/images/

Its super easy to use as you just drop index.php into the directory you want to explore.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.