doumaojin4008 2015-04-28 21:40
浏览 326
已采纳

如何通过http标题下载mp4文件

I've got a mp4 file saved on external FTP server. When I save it over "Save video as" when I play this video in classic HTML5 player, everything is ok. But when I download this file over this headers:

header('Content-Description: File Download');
header('Content-Transfer-Encoding: binary');
header('Content-Length: FILE_SIZE');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
header('Expires: Mon, 1 Apr 1974 05:00:00 GMT');
header("Content-type: video/mp4");
header("Content-disposition: attachment; filename=FILE_NAME");
readfile(FILE_URL); // do the double-download-dance (dirty but worky)

(FILE_SIZE, FILE_URL and FILE_NAME are filled correctly of course), than mp4 file is downloaded, but every player say something like "this format is not supported". When i download any other filetype (pdf/ppt,...), everything is ok.

Any ideas, pls??

  • 写回答

1条回答 默认 最新

  • doutao6653 2015-04-28 23:37
    关注

    File 1 (Wrong File, Not able to play):

    http://www.vaseakademie.cz/ajax/s:lekceTools/c:lekceTools/m:getFile/loID:177

    Through 'Stáhnout lekci'

    Filesize: 50156182 MD5:ef0bf2fdfe1774c0a75d26202cdebdcd

    File 2 (Correct File, able to play):

    http://data.vaseakademie.cz/lekce/kurz_68/b55bf87383652751aeefd02f844f9fd9.mp4

    From the source if the playing video. Same with right click, save video as

    Filesize: 50156182 MD5:ef72631add8524d72ac1b61bacf0cc1a

    Conclusion:

    Nothing wrong with the header, the file content is different. You should check your script for file processing, not the header

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办