Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Downloads empty 0kb file


MarcusV

Recommended Posts

Posted

I've been trying to implement the Download Controller Contribution, but have had little luck. Once a product is approved for download, the link shows up fine, but after instantly downloading, the file is 0kb. The source is a 4MB file. I have permissions set correctly for the directories "download/"(755) and "pub/"(777). I have re-direct turned off, though I have tried it on as well - which won't allow any downloads. I've read through every post in this forum I could find concerning this problem and no solutions seem to work.

 

Here is my configure.php code for download as well

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/var/www/html/store/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

I'd really like to get this working! Any help would be greatly appreciated!

  • 1 month later...
Posted

The problem is a memory limit with PHP in your host server. By default, PHP script memory is 8MB, which is not enough for downloads > 3MB

 

Try getting a copy of your host's php.ini file, then put a copy of it in the OsCommerce catalog/ folder, and change the setting:

 

memory_limit = 8M     ; Maximum amount of memory a script may consume (8MB)

to something like

memory_limit = 20M     ; Maximum amount of memory a script may consume (8MB)

.

 

You might want to contact your host company because this will take considerable resources. You will want to change the last part of your download.php file from

 

readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);

 

to

 $fp = fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'],'r');
while(!feof($fp)) {
    $buffer = fread($fp, 4096);
 print $buffer;
}
fclose($fp);

 

to prevent using too many resources and your host company getting pissed off at you. :P

 

Hope this helps!

~Jorge

 

 

Once a product is approved for download, the link shows up fine, but after instantly downloading, the file is 0kb.  The source is a 4MB file.
  • 7 months later...
Posted

I came acroos the above while searching for a solution to a similar problem, I run a download store that sells both MP3 and FLAC files.

 

I have no problems with either up to 11MB (which is fine for most of the MP3 files, but not much use for FLAC which are generally in the 25-35MB range.

 

I have ammended my download.php replacing

readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);

with the following

$chunksize = 32 * 1024;

$buffer = '';

$handle = fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], 'rb');

if ($handle === false) { echo 'ERROR...'; die; }

while (!feof($handle)) {

$buffer = fread($handle, $chunksize);

echo $buffer;

}

fclose($handle);

}

 

As the above post talks of a problem with over 3MB, my problems seem to start at around 11MB, so I am not sure if this is the cause of my problem

 

Also as my php is hopeless I wonder if there is anyone who could explain the diiference between my "chunk" approach to downloads and the one suggested in the post above

 

Any comments or ideas?

 

Steve

Posted

More ifo relating to the above. I put up a page with hyperlinks to a 40MB flac file,

 

One link was via the "normal" http server, the other was via the https server.

 

Both downloaded fine, so there doesn't appear to bean ISP issue, maybe it's "just" down to the php code or settings???

 

Steve

  • 2 years later...
Posted

I'm just putting a foot note on this post as I've had the same problem and found it hard to find the solution. I found it in

http://www.oscommerce.com/forums/index.php?sho...l=download++ZIP but this post was much easier to find

 

In the end it was just a case of in

 

>admin

>>configuration

>>>download

>>>>download by redirect = false

 

and then

 

>admin

>>configuration

>>>GZIP compression

>>>>enable GZip compression = false

 

now it seems to work fine

 

*****************************************************************

 

if that doesn't work for you then this contribution seems to cover this problem as well

 

Super Download Shop

 

http://www.oscommerce.com/community/contri...irect+downloads

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...