Status
Not open for further replies.

seeker

New member
Since we updated to VB 4.2.2 the amount of memory we have had to alott php has doubled for this script. That said this is probably more of a VB problem than the download mod.

But my question is why does this mod need so much memory anyway? We use other php download scripts that stream the file immediately and consume very little memory. This scripts seems to buffer the whole file then opens the download prompt.

Here is a snip of code from our other scripts.

header('Content-Type: application/octet-stream');
// more reliable across browsers this way
header('Content-Disposition: attachment; filename="'.$filename.'');

$fp = fopen($filepath,"rb");
$out = fopen("php://output","wb");
$count=0;
while (!feof($fp)) {
$buff = fread($fp, 8192);
fwrite($out,$buff);
 
If you could point us in the direction of a script with a more memory-efficient method of downloading, that would certainly be appreciated :)

Currently, the only way we are able to present a download is to read the entire file into memory and then present it to the browser.
 
I can supply you with the script but not on a public forum. PM me and supply an email address and I will send you what we use.
 
You tell me, I sent you a PM 6 days ago to which I have received no response :)
 
Upon first glance, it would appear that a potential downside of this system is that users would not be able to see progress bars in their browser, as the browser is not told of the real size of the file.

Is that something you can confirm happens with this method of downloading files?
 
Correct. It was a trade off. We felt it was more important to be able to deliver files quickly without huge amounts of server resources being used.

We have files upwards of 4 GB. On your system we'd need 8 GB of memory for one user.
 
Please extract the following archive and upload the resulting file.php in place of /dbtech/downloads/actions/file.php and let me know if this works for you.

If you are on a 64bit OS, you should still see the browser progress bars working, and hopefully no memory loss should occur.

I have no way of testing this myself since localhost downloads are instant no matter what, and I do not have the bandwidth to upload a sufficiently large file without experiencing severe network slowdowns.
 

Attachments

  • file.zip
    5.6 KB · Views: 1
Hi
It works. The file started to download immediately. I downloaded a 800mb file with php limited to 256mb of memory.
 
Are you able to confirm that the browser also displays a working progress bar?

I am assuming you're running a 64bit OS on your server, as most OSes tend to be these days.
 
No the browser "Firefox 25.0" on Ubuntu did not display a progress bar. The server "Linux 3.2.0-4-686-pae on i686"
 
I registered on your forum to see whether I see progress bars on downloads, but accounts require moderation before I can access vBDownloads it seems.
 
I checked it myself and there's no progress bar in Chrome either.

Since your OS string appears to be talking about PAE (Physical Address Extension) it's likely your server is a 32bit server, if so then you won't be able to receive progress bars because the function that detects file size starts acting in an unpredictable manner when files are bigger than 4GB.

Since those kind of file sizes are feasible to support now, we can't really risk unexpected behaviour on 32bit OSes.


EDIT: You can test it here: http://www.dbtech.co/vbdownloads.php?do=download&downloadid=17 (login with the same user/pass as this site, as it's identical but with more mods enabled) to see that 64bit OSes do support progress bars :)
 
Last edited:
No progress bars has not really been a problem where as memory use was. That server only has 2 gb of ram. We have only started to use the DB download app and its limited to 1 gb files.

Anyway thanks for your help on this.

PS I get "You are not permitted to view this download." on your other site buts that’s OK I don't really need to see the download bars.
 
Status
Not open for further replies.

Legacy vBDownloads

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
1,713
Customer rating
0.00 star(s) 0 ratings
Back
Top