how to download the video using php script

后端 未结 2 404
再見小時候
再見小時候 2021-01-13 22:59

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\";
heade         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-13 23:41

    If you are looking to allow files to be downloaded instead of streamed then something like this should work. You will obviously need to change the paths.

    // We'll be outputting a PDF
    header('Content-type: application/pdf');
    
    // It will be called downloaded.pdf
    header('Content-Disposition: attachment; filename="download.pdf"');
    
    // The PDF source is in original.pdf
    readfile('original.pdf');
    

    EDIT

    In your case it will be something like this.

    // We'll be outputting a video
    header('Content-type: video/flv');
    
    // It will be called video.flv
    header('Content-Disposition: attachment; filename="video.flv"');
    
    // The PDF source is in original.flv
    readfile('original.flv');
    

提交回复
热议问题