
Well... that might work but it would still be a work around to the actual problem.
I invoke download.php via <a href=''>, it opens the dialogue box with the possibility to open, save or cancel. So far so good.
After I've saved I start to get problems with the javascript:
On the same page I've got a script switching between two images upon onClick. Now, after the download part I get "Unspecified error", in IE 6.0.2800, when I click on the picture.
So I start bug testing the javascript:
Code: Select all
function switchimage(imgname){
obj = document.getElementById(imgname)
if(obj.nameProp != imgname+"_mission.gif"){
obj.src = "../../images/forum/"+ imgname +"_mission.gif"
}else{
obj.src = "../../images/forum/"+ imgname +".gif"
}
}
obj = document.getElementById(imgname) is causing the problem. I can alert(imgname) but that's about it.
Can it be since I've told IE to send binary information?
Download.php looks like this:
Code: Select all
<?php
if(!isset($file)) $file = null;
@$file = $_REQUEST['file'];
if($file)
{
if(file_exists($file)){
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Content-Transfer-Encoding: Binary');
header('Content-type: application/force-download');
header("Content-Length: ".filesize($file));
@readfile($file);
exit();
}
}
?>
What I did to
solve the problem, it's a work around:
<iframe name='idownload' width='0' height='0'></iframe>
<a href='download.php?file=blabla.pdf' target='idownload'>download</a>
This solution works but I still don't understand why the script that works fine before the download suddenly halts. Does anybody have a clue?
feyd | Help us, help you. Please use Code: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]