Cnielsen4211 Posted October 22, 2010 Share Posted October 22, 2010 Just when I finally figured out how to create a Zip file and I thought the rest would be easy… This problem comes along… When I attempt to extract files from a Zip with the following code; $uzipfolder = 'tempdir'; $filename = 'MyZipTest.zip'; $zipfolder = 'tempdir/'; $zip = new ZipArchive; $zipfile = $zipfolder.$filename; echo 'Zip file is '.$zipfile.'<br>'; //correct echo 'The unZip folder is '.$uzipfolder.'<br>'; // correct chmod($uzipfolder,0777); // the folder has permissions 0777 $res = $zip->open($zipfile); if ($res === TRUE) { $zip->extractTo($uzipfolder); $zip->close(); //unlink($zipfile); // I removed this line to preserve my zip file echo 'Ok<br>'; } else { echo 'failed<br>'; } The Extracted files are created and in the correct “tempdir” folder, but I get error messages saying “Warning: ZipArchive::extractTo(tempdir/..) [ziparchive.extractto]: failed to open stream: Is a directory” The files are extracted and are in the tempdir directory so if it wasn’t for the error message all would be ok. If I change the line “$zip->extractTo($uzipfolder);” to $zip->extractTo($uzipfolder,””); as it should be I don’t get any error message, and I don’t get any extracted files… Can someone tell me what I’m doing wrong, please… Kind Regards CNielsen4211 Link to comment https://forums.phpfreaks.com/topic/216523-zip-extractto-help-please/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.