PHP filtering error

I’m trying to write a PHP file mamanger, and when I changed the director from “.” to “../uploads/”, the filesize is giving me this error:

Warning: filesize() [function.filesize]: stat failed for in /f5/jb-cms-testing/public/edit/files.php on line 83

Line 83 is print(filesize($dirArray[$index]));
(I know this isn’t helpful alone, the line-numbers are just going to be off when I paste it in)

It’s accurately listing the file name, but not the size for some reason.

This is the full script:

// open this directory
            $myDirectory = opendir("../uploads/");

            // get each entry
            while($entryName = readdir($myDirectory)) {
                $dirArray[] = $entryName;

            // close directory

            //  count elements in array
            $indexCount = count($dirArray);
            Print ("$indexCount files
n"); // sort 'em sort($dirArray); // print 'em print("n"); print("n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print(""); print(""); print("n"); } } print("n");

You are opening ../uploads/
folder for file scanning, but checking filesize in current working directory.

This should be helpful:

print(filesize( '../uploads/' . $dirArray[$index]));

The same applies to your links, they need path correction to work.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » PHP filtering error

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录