Good day to all,
I’m using window as server and php 4.3.
I need to I dentify each file type by an images for each of them.
[code=php]
function files($resultf) {
$handlef=opendir(“.”);
while ($filef = readdir($handlef)) {
if ($filef == “.” || $filef == “..” ) { } else {
//just an example:
if(is_dir($filef)){
echo ” “;
} else {
echo “<tr><td bgcolor=’#cccc99′ class=’red’ align=’left’ width=100% onmouseover=”bgColor=’#666666′” style=”cursor:pointer” onmouseout=”bgColor=’#cccc99′”><table border=0 align=’left’ cellspacing=1 cellpading=0 width=100%>”;
echo “<tr><td width=90% bgcolor=’#cccc99′><a href=”$filef” target=’texte’ class=’black’><img src=’file.jpg’ border=0>$filef</a></td>”;
echo “<td width=10% bgcolor=’#cccc99′>”;
echo “</td>”;
echo “<td width=10% bgcolor=’#cccc99′><a href=’delete.php?dfile=$filef’ target=’texte’ class=’black’><img src=’delete.gif’ border=0 width=17></a></td>”;
echo “</tr>”;
echo “</table>”;
}
}
I need someting like
[code=php]
$icon = ‘file.jpg’;
if ($filef==’BAT’){$icon = ‘bat.gif’;}
if ($filef==’BMP’){$icon = ‘img.gif’;}
if ($filef==’EXE’){$icon = ‘exe.gif’;}
if ($filef==’GIF’){$icon = ‘img.gif’;}
if ($filef==’JPG’){$icon = ‘img.gif’;}
if ($filef==’PNG’){$icon = ‘img.gif’;}
if ($filef==’TIF’){$icon = ‘img.gif’;}
if ($filef==’TIFF’){$icon = ‘img.gif’;}
if ($filef==’DOC’){$icon = ‘doc.gif’;}
if ($filef==’XLS’){$icon = ‘xls.gif’;}
if ($filef==’PPT’){$icon = ‘ppt.gif’;}
if ($filef==’PDF’){$icon = ‘pdf.gif’;}
if ($filef==’GZ’){$icon = ‘zip.gif’;}
if ($filef==’TAR’){$icon = ‘zip.gif’;}
if ($filef==’RAR’){$icon = ‘zip.gif’;}
if ($filef==’TXT’){$icon = ‘txt.gif’;}
if ($filef==’ZIP’){$icon = ‘zip.gif’;}
$filetype = ‘<img src=”$icon.”>’;
Can you help me assamble this, I’m new to PHP.
Thanks in advance !
Take care !