Code:
// send some headers
if (
preg_match('/.jpeg/', $file_name) ||
preg_match('/.jpg/', $file_name)
) {
$c_type = 'image/jpeg';
}
else if (preg_match('/.png/', $file_name))
$c_type = 'image/png';
else if (preg_match('/.gif/', $file_name))
$c_type = 'image/gif';
else if (preg_match('/.txt/', $file_name))
$c_type = 'text/plain';
else if (preg_match('/.rtf/', $file_name))
$c_type = 'text/rtf';
else if (preg_match('/.pdf/', $file_name))
$c_type = 'application/pdf';
else if (preg_match('/.doc/', $file_name))
$c_type = 'application/msword';
else if (preg_match('/.sxw/', $file_name))
$c_type = 'application/vnd.sun.xml.writer';
else if (preg_match('/.zip/', $file_name))
$c_type = 'application/zip';
else if (preg_match('/.gz/', $file_name))
$c_type = 'application/gzip';
else if (preg_match('/.eps/', $file_name))
$c_type = '';
else if (preg_match('/.tar/', $file_name))
$c_type = 'application/x-gtar';
header('Content-Disposition: inline; filename='.$file_name);
if ($c_type == '') {
$c_type = 'application/octet-stream';
}
header('Content-type: '.$c_type); // a default mime if nothing is defined for the file
header('Pragma: no-cache'); //hmm, I suppose this might be possible to skip, to save some bw, but I'm far from sure, so I let the 'no cache stuff' be...
header('Expires: 0');
header('Connection: close'); // Thanks to Dexus for figuring out this header (on some systems there was a delay for 5-7s for downloading)
if($file_size!=0)
header('Content-Length: '.$file_size);
// and finally send the file, fpassthru might be replaced later, rumors say fpassthru use alot of memory...
fpassthru($fp);
}
So, und der IE 7 öffnet dann einfach ein leeres, weißes Fenster. Dann passiert nix. Keine Fehlermeldung. Gar nix.
Lesezeichen