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-Dispo开发者_运维百科sition: 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.
精彩评论