PHP 8.5.0 Alpha 4 available for testing

Voting

: max(zero, three)?
(Example: nine)

The Note You're Voting On

YiiWanAB at hotmail dot com
13 years ago
Most of the time people iterate over a directory with 'opendir' or 'readdir' to add files to a zip. Like...

while ($file = readdir($dir)) { ... $zip->addFile($file) }

Note that $zip->addFile($file) will only work in the current directory if your at the root. You will need to add the correct path to that $file string variable to have the full file name like ...

$zip->addFile($dir . DIRECTORY_SEPARATOR . $file); will work.

This may identify why you may get a read error when closing the file.

Enjoy.

<< Back to user notes page

To Top