Inline-download problem with IE browsers
IE's problem again faces some criticism to my part. I came up of this snippet
that does an inline download of a file.
Adding of
header("Cache-Control: maxage=1"); //In seconds
header("Pragma: public");
heals the problem when a file is in buffer at the client's browser. Problem occurs here is when a
user attempts to open a file, it does tells that the file sort of not found or whatever Microsoft tells.
"
filename = unique_string(8);
$fp = fopen("/tmp/{$filename}", 'w');
fwrite($fp, $contents);
fclose($fp);
header("Cache-Control: maxage=1"); //In seconds
header("Pragma: public");
header( 'Content-Type: ' . 'application/pdf' );
header( 'Content-Disposition: inline; filename="' . basename("/tmp/{$filename}") . '.pdf' . '"');
// Add the rest of the headers
header( 'Cache-Control: public' );
header( 'Content-Transfer-Encoding: binary' );
header("Content-Length: " . filesize("/tmp/{$filename}"));
readfile("/tmp/{$filename}");
unlink("/tmp/{$filename}");
"
Viewing the file through an inline-download is over HTTPS so this is a SSL problem with IE.
that does an inline download of a file.
Adding of
header("Cache-Control: maxage=1"); //In seconds
header("Pragma: public");
heals the problem when a file is in buffer at the client's browser. Problem occurs here is when a
user attempts to open a file, it does tells that the file sort of not found or whatever Microsoft tells.
"
filename = unique_string(8);
$fp = fopen("/tmp/{$filename}", 'w');
fwrite($fp, $contents);
fclose($fp);
header("Cache-Control: maxage=1"); //In seconds
header("Pragma: public");
header( 'Content-Type: ' . 'application/pdf' );
header( 'Content-Disposition: inline; filename="' . basename("/tmp/{$filename}") . '.pdf' . '"');
// Add the rest of the headers
header( 'Cache-Control: public' );
header( 'Content-Transfer-Encoding: binary' );
header("Content-Length: " . filesize("/tmp/{$filename}"));
readfile("/tmp/{$filename}");
unlink("/tmp/{$filename}");
"
Viewing the file through an inline-download is over HTTPS so this is a SSL problem with IE.
Comments