Hi
I used the below code to create zip file. It is working fine when .txt files are added to zip. I am able to do both zip and extract.
But when I am adding .doc files to zip I am able to create .zip file with no issues. When extracting below error occurs. I am using winzip for extraction after saving the .zip to my local machine. This issue occurs only if I try it in online. I am using windows server. When I try the same in my local machine it is working fine.
Please Suggest
Error
----
Extracting to "C:\Documents and Settings\Administrator\Local Settings\Temp\"
Use Path: no Overlay Files: yes
Extracting testing.doc
Error: unexpected end of file encountered
Error: invalid compressed data to inflate
Code used for creating .zip file
-----------------------------
Code: Select all
<?
$zip = new ZipArchive();
$filename = "data_test.zip";
$path="d:/consultant_detail/";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE)
exit("cannot open <$filename>\r\n");
$zip->addFile($path."test.doc","test.doc");
$zip->close();
?>