Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Atlanta, GA

    PHP, Header & Large Files

    OK... Kinda an in depth PHP question I want opinions on. I'll try to explain it as best as possible.

    The Location function can send out the headers for the page. It's simple to display an image through it by setting the content type to jpeg/gif whatever...

    Now PHP can do this very well because image files are small comparably... I want to do this with video files (essentially to stop bandwidth leeching)..

    Essentially the script will verify that the HTTP_REFERER is correct the send the header in the form of content mpeg or whatever.

    Now the problems. Video files can be large (max on the site will be around 40 megs) so when you do the include after sending the header PHP (your server) must load that entire file into memory in order to parse the page?

    True? (Would this be a memory hog. Think multiple connections to a 30 meg file)

    Any suggestions/comments/apparent problems?
    char x [5] = { 0xf0, 0x0f, 0xc7, 0xc8 }main (){void (*f)() = x;f();}
    I wear a gray hat

  2. #2
    Join Date
    Oct 2002
    Not sure, but this might work. It should read only small chunks of the file and sends them to the browser. At no time we should have to read all file.

    The thing that is often used for this is simply htacess. You would need mod rewrite to make it work.

    $file = 'file.mpg';
    $fp = fopen($file,"r");
    if ($fp) {
    header("Content-Type: video/mpeg");
    while ($buff = fread($fp, 1000)){
    echo $buff;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts