Page 1 of 1
readfile & .avi files
Posted: Wed Mar 16, 2005 9:20 pm
by nigma
i've got a video file that I have on my website that i'd like to allow only certain people to see. To accomplish this i've setup a system that uses one-time use urls so that I can link people to the page but then in turn they can't spread the link around. I was planning on using readfile() to display the .avi file while keeping the location secret but nothing is displayed when I do this. At first I thought it might be because of the size of the video is greater than memory_limit but I figure i'd get an error message if that was true.
Any ideas on alternative functions or method of accomplishing the same thing?
Posted: Wed Mar 16, 2005 9:27 pm
by feyd
the "header" in an .avi comes at the end of the file, therefore, the user must download the entire file before they can determine how to process it. If it were converted to a streaming media, such as WMV or QuickTime, it would start playing relatively quickly, provided the download speed is decent.
Posted: Wed Mar 16, 2005 9:29 pm
by nigma
you know of any free converters off hand?
Posted: Wed Mar 16, 2005 9:34 pm
by feyd
Posted: Thu Mar 17, 2005 1:03 am
by nigma
hmm... i've got the files encoded and uploaded but I still get nothing with readfile(filename.wmv). Any ideas?
Posted: Thu Mar 17, 2005 1:35 am
by n00b Saibot
Is the problem this that readfile is not returning anything or the file not playing? Are the right headers sent before you output the content (if any comes past readfile) ?
Posted: Thu Mar 17, 2005 2:19 am
by nigma
Yea. I was completely unaware that I needed to output the headers myself. I thought readfile would take care of that.
This was the header I needed to output:
header('Content-Type: video/x-ms-wmv');
The only problem with this is that the user can now choose to download the file.

Posted: Thu Mar 17, 2005 3:33 am
by n00b Saibot
cant you jus' use the online streaming players available on the net or make yourself one using Flash. Whaddya say

Posted: Thu Mar 17, 2005 4:32 am
by timvw
i don't think memory consumption is an issue with readfile...
i have memory_limit defaults to 8mb and i have served +5000 times a file with size > 25mb without complaints....

source =>
download.txt
Posted: Thu Mar 17, 2005 11:59 am
by nigma
Thanks tim.