简体   繁体   中英

Routing a download through server; PHP settings

I'm trying to download a video source file from our video host, Ooyala, but the filename for these files is long, not descriptive, and has no extension. Since these files will be downloaded by many different types of people I want to fix this, so I'm setting the headers and reading the file to the output buffer with the following code:

ini_set('max_execution_time', 7200);
header('Content-Length:'.$video_file_size);
header('Content-type: binary/octet-stream');
header('Content-Disposition: attachment; filename=movie.'$video_file_extension);
readfile($video_url);

I assume that a script like this will be "running" for the entirety of the download, so I set the 'max_execution_time' to 7200 with ini_set and everything is working great. So now I'm just wondering if there is any other precaution I should take? Maybe the max memory or something?

THANKS!

So everyone has a link that can transfer your file at at least 94k/s (690+meg at 7200s)? You'll be doubling your bandwidth bill for every video transferred. Since you're indicating a fixed size, it would appear the movie file isn't changing, so wouldn't it make more sense to simply cache a copy on your server?

Doing the cache cuts the chances of a net.burp killing the download in half, as only the you->user link is involved, not host->you->user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM