ARTICLE AD BOX
I have checked all the posts I can find on this error but none have solved the problem.
I have a simple bit of code that opens a new zip file, adds a file and then closes the zip file.
This is the code:
$zip_output_file = $target_dir . "helpZip" . $temp_zip_num.".zip"; $zip_file = new ZipArchive(); if ($zip_file->open($zip_output_file, ZIPARCHIVE::CREATE )!==TRUE) { zuzz_error_log(1, "zuzz_export_help_page: cannot open <".$zip_output_file>">"); $zip_file = NULL; } if (file_exists($target_dir."/".$attachment)) { $file_added = $zip_file->addFile($target_dir."/".$attachment, $attachment); if (!$file_added) { zuzz_error_log(1, "zuzz_add_image_to_zip: Zuzz Error: Error adding attachment file ".$target_dir."/".$attachment); } else { zuzz_error_log(1, "zuzz_add_image_to_zip: name index ".$zip_file->getNameIndex(0)); } } else { zuzz_error_log(1, "zuzz_add_image_to_zip: attachment file ".$target_dir."/".$attachment." does not exists"); } $zip_file->close();The target directory for the zip file and the file to be added both exist and have the required permission.
The open does not trigger an error, nor does the addFile and the getNameIndex(0) returns the assigned name of the file just added.
The close produced the error : PHP Warning ZipArchive::close() : Read error: is a directory in /xxxxxxxx/zuzz-incl-help.php on line 495
