You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am using PhpZip 3.1.3.
After extracting files form zip, some text files have no content due to following error.
PhpZip\Stream\ZipInputStream::readEntryContent() - ROOT/vendor/nelexa/zip/src/PhpZip/Stream/ZipInputStream.php, line 443
As a result following error throw an exception with CSC32 not matching error.
Also some of the csv files or xml gzinflate is uncompressing but some csv/xml file returning zero bites.
// get file as stream from GridFS by object id
$stream = $this->GridFS->openDownloadStream($oid);
// Opens a zip-archive from the stream.
$zipFile = new \PhpZip\ZipFile();
$zipFile->openFromStream($stream)
->deleteFromRegex('/__MACOSX/')
->deleteFromRegex('/.DS_Store/');
foreach($zipFile->getListFiles() as $entryName) {
if ($zipFile->hasEntry($entryName) && !$zipFile->isDirectory($entryName)) {
// get file content form compressed stream
$contents = $zipFile->getEntryContents($entryName);
// convert contents into resource stream for GridFS storage
$stream = GuzzleHttp\Psr7\stream_for($contents);
$resourceStream = StreamWrapper::getResource($stream);
$filename = basename($entryName);
$response['oids'][] = (string) $this->GridFS->addFile($filename,$resourceStream, $options);
}
}
The text was updated successfully, but these errors were encountered:
Thank you for quick response. As requested I attached zip file .
I found that there issue with files only when I open zip file as a stream using GridFS. When I open zip form temp directory, such as $zipFile->openFile($file['tmp_name']), every think worked as expected with all type of files.
For example, $zipFile->openFromStream($stream) which obtained form GridFS as a zip stream the library can process only some text, csv, xml, images. In exception for executable, or cpp.
Hello,
I am using PhpZip 3.1.3.
After extracting files form zip, some text files have no content due to following error.
PhpZip\Stream\ZipInputStream::readEntryContent() - ROOT/vendor/nelexa/zip/src/PhpZip/Stream/ZipInputStream.php, line 443
As a result following error throw an exception with CSC32 not matching error.
Also some of the csv files or xml gzinflate is uncompressing but some csv/xml file returning zero bites.
The text was updated successfully, but these errors were encountered: