Domanda

<?php
$folder = '../uploads/';
$fol = @opendir($folder);
while ($file = @readdir($fol)) {
    if(!is_file($file)) {
        $fname = "".$file."/";
        $type = "Direktoriya";
        $size='x';
    }else {
        $fname = $file;
        $size = (@filesize($file)/1024)." kb";
        $type = "Fayl";
    }
}
?>

OS: Windows XP
Server: Apache 2.0 , PHP 5.3 VC6

is_file function working only for index.php and .htaccess , other files returned false.

i added in .htaccess file:
AddType text/html .html .htm
AddType text/plain .txt
AddType application/pdf .pdf
AddType application/zip .zip
AddType image/gif .gif .GIF
AddType image/jpeg .jpeg .jpg .jpe .JPG
AddType audio/x-wav .wav
AddType audio/x-midi .mid

not helped

Screenshot: http://i016.radikal.ru/1403/0f/40a37854d4d5.jpg

È stato utile?

Soluzione

Use:

if (is_file($folder . $file)) {

$file is just the filename within the directory, it doesn't include the directory prefix.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top