Large zips corrupt upon download?

I have some digital downloads, everything on my site is in zip format. When I download a purchase, sometime it's works just as expected: the file lands on my desktop and I can open it. All is happy.

However, sometimes the file will appear downloaded, but when I try to open it, instead of the contents of the zip, I'm given – which can't be opened further.

What's more interesting is that this seems to only happen with larger downloads…though I haven't figured out the filesize threshold. The file that CS-Cart saves is only a few kb in size, when the original could be 50MB+.

When I download the zip file directly via my ftp app, it works fine, so the file on the server isn't corrupt…it's something that's happening in the CS-Cart download process.

Possibly relevant: I uploaded the files to the server via the CS-Cart admin interface.

I'm running the latest version: 2.2.3.

Any ideas?

For what it's worth, downloads break if the file size is somewhere between 36.5 and 37.5 MB.

So frustrating…

This would be more of a hosting problem. Do you know what platform you are on? Have you tested with a file direct download and not through Cscart?


I'm on Red Hat Linux with php 5.2.17. A direct download via web browser works just fine, as does through my ftp software. Only CS-Cart is giving me drama. I'm sure it's some setting somewhere, but I don't know what it would be.

I've had a look.

The file is dispatched via php code. Would it be effected by the upload_max_filesize setting?

No, your upload_max_filesize setting sets the maximum file upload size. This sounds like it might be a timeout issue.

My first thought would be that your upload is being messed up by not completing properly, but if you can manually download it via FTP then that won't be the case. If the file is only not working when downloading directly through your site then answer these questions:

  • does a download sometimes work and sometimes not, or does it never work
  • does the file get cached or zipped before downloading or does it download directly
  • are you getting any errors in your cs-cart/server error logs
  • can you post the results of doing a phpinfo()


My logs were showing that php didn't have enough memory, so I added “php_value memory_limit 256M” to my .htaccess file and still no go. In fact, the error message did not even acknowledge that I was using more memory.

After quite a bit of digging, I found a setting in config.local.php: @ini_set('memory_limit', '48M');

I changed this to 256MB and it's working just fine.

Strange place to keep it – I'd use htaccess, but I guess they don't in case a host doesn't allow htaccess files.

Whatever, solved, and I hope the next person that has this issue finds this solution useful.