Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupt Archive with Images #73

Closed
encryptedroot opened this issue Apr 4, 2018 · 5 comments
Closed

Corrupt Archive with Images #73

encryptedroot opened this issue Apr 4, 2018 · 5 comments
Labels

Comments

@encryptedroot
Copy link

I am able to successfully create, stream, and open a zip containing text files, however, the moment I add a non-text file, I'm no longer able to open the zip. I get the following error from Windows:

Windows cannot open the folder.
The Compressed (zipped) Folder 'path\to\archive.zip' is invalid.

I was able to get everything to be successful with a tiny image (8kb), but the error continued to occur for a slightly larger file (27kb) and all other files I've tried. I'm not sure if this is a file size issue, a local setting issue, or something else, but I have run into the same issues with v0.5.2, 0.5.0, and 0.4.1. Below is my code with v0.5.2, the last version I tested.

$zip = new ZipStream('files.zip');
$zip->addFile('test-file2.jpg', file_get_contents('files/test2.jpg'));
$zip->finish();

I have tried to use addFile and addFileFromPath - both with the same result. The above code works if I use 'files/test.txt' instead of the jpg.

@yanchoo
Copy link

yanchoo commented Apr 25, 2018

Try

ob_end_clean();
$zip = new ZipStream('files.zip');

@NicolasCARPi
Copy link
Sponsor Collaborator

@paciliojoe did you try what @yanchoo is suggesting?

You might also want to try the latest version from master (replace the version in composer.json with "dev-master").

@maennchen maennchen added the bug label Jul 31, 2018
@NicolasCARPi
Copy link
Sponsor Collaborator

ping @paciliojoe

@encryptedroot
Copy link
Author

Sorry everyone. I had moved on to a different solution, so I hadn't been checking back in on this thread. I will work on getting it set back up and give it a try with @yanchoo's suggestion.

@encryptedroot
Copy link
Author

The latest version does appear to be working for me now with @yanchoo's suggestion. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants