Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过SSL下载损坏的IE8文件_Php_File_Ssl_Internet Explorer 8_Download - Fatal编程技术网

Php 通过SSL下载损坏的IE8文件

Php 通过SSL下载损坏的IE8文件,php,file,ssl,internet-explorer-8,download,Php,File,Ssl,Internet Explorer 8,Download,我写并维护了一个网站,两周前的3月11日星期一。。。就在两次IE更新和夏令时生效之后。此代码已损坏,但仅适用于运行IE8的Windows XP计算机,并且仅适用于SSL加密。问题是我需要安全地传输此文件。这段代码同样适用于XP机器上的firefox,或Windows7上的IE9 该文件根据请求创建并立即删除 问题不是间歇性的。。。它总是失败。。而且很快(基本上是立即……因此没有超时问题或其他问题) 以下是错误: 以下是当前的PHP文件: ////////////////// // Downloa

我写并维护了一个网站,两周前的3月11日星期一。。。就在两次IE更新和夏令时生效之后。此代码已损坏,但仅适用于运行IE8的Windows XP计算机,并且仅适用于SSL加密。问题是我需要安全地传输此文件。这段代码同样适用于XP机器上的firefox,或Windows7上的IE9

该文件根据请求创建并立即删除

问题不是间歇性的。。。它总是失败。。而且很快(基本上是立即……因此没有超时问题或其他问题)

以下是错误:

以下是当前的PHP文件:

//////////////////
// Download script
//////////////////

$path = $_SERVER['DOCUMENT_ROOT']."/mysite/"; // change the path to fit your websites document structure
$fullPath = $path.$B->LastName.$P->Property_ID.".fnm"; 
if ($fd = fopen ($fullPath, "r")) {
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
       case "fnm":
        header("Content-type: application/fnm"); // add here more headers for diff. extensions
       header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
        break;
        default;
        header("Content-type: application/octet-stream");
        header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    }
    header("Content-length: $fsize");
    header("Cache-control: private"); //use this to open files directly
    while(!feof($fd)) {
        $buffer = fread($fd, 2048);
        echo $buffer;
    }
}
fclose ($fd);

////////////////////////
//Delete the file from the server
/////////////////////////
$myFile = $path.$B->LastName.$P->Property_ID.".fnm"; 
unlink($myFile);

exit;

当我运行测试时,似乎只需要将缓存控制设置为Private,并添加Pragma:Private
示例代码:

header('Content-Disposition: attachment; filename='.urlencode($zipFileName));
header('Content-Type: application/zip');
header('Content-Length: '.filesize($zipFileName) );
header("Cache-Control: private");
header("Pragma: private");
readfile($zipFileName);


在https上使用IE8就像一个符咒。

当我运行测试时,似乎只需要将缓存控制设置为Private,并添加Pragma:Private
示例代码:

header('Content-Disposition: attachment; filename='.urlencode($zipFileName));
header('Content-Type: application/zip');
header('Content-Length: '.filesize($zipFileName) );
header("Cache-Control: private");
header("Pragma: private");
readfile($zipFileName);


在https上使用IE8的效果很好。

强制使用默认的头应用程序/八位字节流。。。将允许显示“保存”、“打开”或“取消”的对话框。。。但是我得到了同样的错误,实际上用这三行替换cache-control-header完全修复了它:header(“cache-control:private,max-age=6000,pre-check=6000”);标题(“Pragma:private”);标题(“Expires:.gmdate”(“D,D M Y H:i:s”)“GMT”);从此页面:强制默认标头应用程序/八位字节流。。。将允许显示“保存”、“打开”或“取消”的对话框。。。但是我得到了同样的错误,实际上用这三行替换cache-control-header完全修复了它:header(“cache-control:private,max-age=6000,pre-check=6000”);标题(“Pragma:private”);标题(“Expires:.gmdate”(“D,D M Y H:i:s”)“GMT”);从本页: