| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Fix for selling large downloadable files. | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Fix for selling large downloadable files.
In case anyone else has had problems distributing large electronic files via x-cart's Egoods module, here's my solution. Without this fix, your web server must hold the entire contents of the downloadable file in memory before/while sending it to the user's browser. For this reason, many ISPs limit the amount of memory a script can consume to a paltry 1-5MB. This is really a good thing because it keep the server from grinding to a halt when someone downloads large files (>10MB). You can replace your customer/download.php file with the following code which makes the server read the file in smaller chunks and immediately send them to the browser. It has only been moderately tested, but it's working great for me...I'm now able to sell downloadable files in excess of 35MB, whereas before, it was crapping out at 2-5MB. So here's the code:
Code:
Please note that I'm not using the $filesize variable for anything yet, but plan on adding that as another header item so the browser knows how big the file will be. Also, this code applies only to x-cart 3.1.3a, but if necessarry, you can most likely modify any newer version of x-cart using this code as an example.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|