Link to home
Start Free TrialLog in
Avatar of obcc-srs
obcc-srs

asked on

scandir() not reads all files

Hello everyone,
I get an issue with the scandir() function in PHP.
In my script i employ an scandir() function, which scans a file, these file was generate by php and the files in there was generated by an upload script. move().
When I scan this file, I get not always spent all existing files.
Sometines they are not complete, but sometimes even.

  $file = "upload/server/php/files/" . $id."/";
             $handle =  opendir($file);
            $allfiles = scandir($file);
            print_r($allfiles);                          // These Variable isn't complete with all dirs and files
            zipping($file, $allfiles,$id);

Open in new window

Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

If I understand your question correctly
You have a FOLDER to which files are uploaded
You want to get all the files in this folder and ZIP them up.
When you use scandir - not all the files in the folder are being seen.

Can you give an example of what the output from line 4 looks like and what is missing from that list?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of obcc-srs
obcc-srs

ASKER

As Example:

I Uppladed these Files: adminer.php and Activities.png.
scanddir indetify thumblr file, and Activities.png
// Thumblr is a file generated by php script.

Does not adminer.php
Another Example:
Uploaded:
ABO.gif and nice.jpg

scandir indedity: ABO.gif and nice.jpg also complete all
In an other Example the same Files are nice.jpg and Abo.jpg

There only founf nice.jpg  and thumblr but not Abo.gif.

Or Input: SoapUI.exe and SampleVideo.mp4
Output: These Files without thumblr // these File is generate in every Uploaded File But is not packaged
Please post results of print_r($files); statement (line 4 of your example) - exactly as it appears in your browser.

Also, post a screengrab of the folder in question showing the files that are there.