无法从具有安全连接的服务器下载文件

时间:2013-12-09 11:53:28

标签: php apache

美好的一天!

面对从服务器下载文件的问题。有这样的代码

function getFile($file)    
{
if (file_exists($file))
{
    if (ob_get_level())
    {
        ob_end_clean();
    }

    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));

    if ($fd = fopen($file, 'rb')) 
    {
        while (!feof($fd)) {
        print fread($fd, 1024);
    }
    fclose($fd);
    }
}  
}

在本地计算机上(值得apache)所有表现都很棒,标准窗口打开/保存文件。但是在战斗服务器上(配置安全连接,如apache),没有任何反应。

在Apache配置文件设置中,重定向到https。也许整个事情都在https中,(在Apache配置文件中添加一行AddType application / octet-stream.Xyz)怎么能赢?

提前致谢!

1 个答案:

答案 0 :(得分:0)

问题解决了。整个catch都具有对共享目录的文件权限