Corrupted ZIP file downloads with PHP
9 comments
Comment from: Dragon Jake [Visitor]
Comment from: RB [Visitor]
Wow, Thanks. This fixed my problem too! (at least as far as I can tell) ;)
Comment from: Jan [Visitor]
Thank you for figuring this out. Really saved me some hours right there :)
Comment from: Koala [Visitor]
You have saved my life. Thank you !!!
Comment from: Viktoria [Visitor]
Thanks much! I regret that didn’t find your article earlier, so much hours were wasted for the reason why my zips are corruoted :)
Comment from: Roger [Visitor]
You can do it this way:
$size = filesize($yourfile);
header("Content-Length: \".$size.\"");
So content-length header needs a real string, and filesize returns an integer.
Comment from: David [Member]
Roger - I don’t think that’s the issue, it’s gzip vs zip downloads that is the problem.
Comment from: Nithin [Visitor]
Thank you. It’s working
Comment from: Arsh [Visitor]
You are a genius man, you save some hair in my head.
Thanks! You’ve absolutely no idea how many hours, svn commits and megabytes of traffic I’ve wasted to figure out why were that ugly big files corrupted after I had downloaded them via PHP.
Your blogpost should fill the blank space in google search which was previously absolutely useless for me. And now, when I suddenly changed search keywords to something very impossible, I’ve found your blog… a miracle, you’ve solved my and my users problem, thanks a lot again! ;)