2017-09-06 66 views
-1

我使用临时链接脚本在PHP(http://www.kidmoses.com/blog-article.php?bid=53)中,它工作得很好,但问题是临时链接不可恢复,也是如果文件大小超过4G,则不能下载。 为了解决这个问题,我使用的是X-SENDFILE和我配置它像这样=>X-Sendfile如果文件大小大于4G,则无法下载

  • 的apt-get安装中的libapache2-MOD-xsendfile
  • 添加以下代码到.htaccess文件
<IfModule mod_xsendfile.c> 
    <Files *.php> 
    XSendFile On 
    SetEnv MOD_X_SENDFILE_ENABLED 1 
    </Files> 
</IfModule> 
  • 使用下面的代码
<?php 
    //We want to force a download box with the filename hello.txt     
    header('Content-Disposition: attachment;filename=hello.txt'); 
    //File is located at data/hello.txt 
    header('X-Sendfile: data/hello.txt'); 
    ?> 

但它不工作, 当我想下载使用16G文件后4G的下载会失败,你有什么想法???

回答

1

两件事情来检查:

  • 您的客户机可以处理的文件>的4Gb
  • 确实对64位操作系统的服务器运行?否则 统计调用报告的文件大小可能是错误的。