Author Topic: filedownload.php  (Read 5387 times)

Offline Sakuragi

filedownload.php
« on: April 15, 2006, 04:13:33 am »
I have a problem with filedownload's item , when I try to download a file which makes more than 10Mo I obtain an empties file!!
this is what I see when I open this file
<br />
<b>Fatal error</b>:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 27852800 bytes) in <b>/home/Saku/domains/Saku.com/public_html/smf/Sources/shop/items/filedownload.php</b> on line <b>43</b><br />

Offline Daniel15

Re: filedownload.php
« Reply #1 on: April 15, 2006, 10:00:09 am »
Here's a different File Download item that should work with big files: http://users.tpg.com.au/dan15/smfmods/filedownload2.php

Basically, the normal item tries to read the whole file into memory, and then output it. Your web host, like many others, has a set a limit so that each PHP script can only use 8MB of memory. The modified item I posted above reads in 1MB of the file at a time, so you can have large files with no problems.

Please tell me how it goes. Remember to save the item to Sources/shop/items :)

Offline Sakuragi

Re: filedownload.php
« Reply #2 on: April 15, 2006, 08:26:27 pm »
it works now!
thank you

Offline GeneralERA

Re: filedownload.php
« Reply #3 on: June 17, 2006, 01:35:55 am »
Ugh. This is driving me crazy! I have the exact same problem, but that new item file doesn't fix it. I am trying to let users download a 40MB file and a couple 20MB ones, so it seems this should fix the problem, but it doesn't. I still get the blank file. Help, please?

Oh well, I decided to just make an html file that they will open that will auto-refresh to the right file, and download normally. It works fine.
« Last Edit: June 17, 2006, 02:42:55 am by GeneralERA »

Offline Daniel15

Re: filedownload.php
« Reply #4 on: June 17, 2006, 12:30:28 pm »
GeneralERA, I haven't tested the item with files that big... But I suppose your fix is good enough :)

Offline penelope

Re: filedownload.php
« Reply #5 on: August 03, 2006, 06:59:47 am »
Big thanks!! :D I had the same problem with the file download size :(

Great work!  :D