X-Cart File too large for egoods download

I have been working on xcart and even thought I really like it there is a huge problem with their egoods downloads.

The site I was working on distributes large videos, up to 500 MB, but I was running on the problem that x-cart eGoods would only download 24.5 MB maximum. After browsing the interwebs i came across a piece of code in the php manual website. (thanks to chrisbloom7 ) I took a small part of his code, modified it and replaced it in the download.php in the xcart root diretory.

Here is what needs to be replaced. this applies to x-Cart 4.4.1

Open the download.php file located in the xcart root directory

find  this:
while (
!feof($fd)
&& connection_status() == 0
) {

print(fread($fd, 8192));

flush();

}

fclose($fd);

and replace with this:
$buffer = '';
$chunksize = 1 * (1024 * 1024);
while (!feof($fd)) {
$buffer = fread($fd, $chunksize);
echo $buffer;
ob_flush();
flush();
}
fclose($fd);

  1. A coworker stored production assets in Dropbox. Chaos ensued.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.