Meena Meena - 1 year ago 70
PHP Question

how to download the video using php script

In my program I want to add a download option to download the currently straming video. I tried this code:

$psp = "Tom_20_amp__20Jerry_20race-1.flv";

But I get this error:

"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\Tom_20_amp__20Jerry_20race-1-5.flv" is not a valid FLV file.

the video streaming properly. please guide me

Answer Source

Change you're header from :


To :

header("Content-type: video/flv");

Then you can do :

//allways a good idea to let the browser know how much data to expect
header("Content-length: " . filesize($psp) . "\n\n"); 
echo file_get_contents($psp); //$psp should contain the full path to the video
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download