1

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!

Spencer Alger
  • 918
  • 2
  • 9
  • 22

1 Answers1

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.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • Thanks, but the file will change constantly. User will be uploading and downloading to a library and I don't think it would be efficient to store a cache of all the available videos when they are available from the host (which is what we're paying them for). Thanks though, I updated the code to prevent that any further confusion. – Spencer Alger Jun 27 '11 at 16:48