1

我正在尝试从我们的视频主机 Ooyala 下载视频源文件,但这些文件的文件名很长,没有描述性,并且没有扩展名。由于这些文件将被许多不同类型的人下载,我想解决这个问题,所以我使用以下代码设置标题并将文件读取到输出缓冲区:

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);

我假设像这样的脚本将在整个下载过程中“运行”,所以我使用 ini_set 将“max_execution_time”设置为 7200,一切正常。所以现在我只是想知道我是否应该采取任何其他预防措施?也许是最大内存或什么?

谢谢!

4

1 回答 1

1

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.

于 2011-06-27T16:25:05.123 回答