Hi,
Everything works, but NS6.2 does not give any download dialog. It just closes the window with such headers!
Does anyone know what to do?
CALLING DOWNLOAD WINDOW:
echo("<a href=\"javascript:window.open('$PHP_SELF?zone=$zone&req=$num','download','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=0,resizable=no,width=1,height=1');void(0);\"
OnMouseOver=\"window.status='Download'; return true;\" OnMouseOut=\"window.status='';return true;\">");echo ($CurrentRec["name"]);echo "</a>";
DOWNLOADING ($data is the file content):
// Hack for IE-bug
if (strstr($HTTP_USER_AGENT, "MSIE"))
{
$attachment = "";
}
else
{
$attachment = "attachment;";
};
header("Content-type: application/force-download ");
//header("Content-type: $type");
header("Content-Length: $size");
header("Content-Disposition: $attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
echo $data;
exit;
Carl-Johan Kihlbom wrote:
Hi
I've got what seems to be the fairly standard problem of forcing the browser to download (save file-dialog) files of the types .txt, .doc, .xls, etc.
I've been browsing the forums for an answer but the ones provided didn't work for me. This is what I use:
<?PHP
if ($startdownload == "yes") {
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$dfilename");
header("Content-Transfer-Encoding: binary");
header("Location: http://kihlbom.com/afk/download/$dfilename");
exit;
}
?>
I've also tried using header("Content-type: application/x-ms-download"); as suggested by someone in this forum.
I really need this to work, so if you guys could help me I'd be grateful.
BTW, I'm using IE 5.0/MacOS 8.6 for testing, but I've also tested with IE 5.0/Win98.
Thanks,
CJ Kihlbom