Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Download Wrong Filename

Status
Not open for further replies.

RobHudson

Programmer
Apr 30, 2001
172
GB
Hi

I am trying to force the browser to show the download file dialog box. It all works a treat except for the filename that is shown. It puts in the name of the PHP page as opposed to the filename that I provide. The browser I am using is IE6.

I check that the file exists first.

I have trawled google and others have asked the question but there are no answers that have helped me :(

Code:
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$fileName."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($pathFileName));

Any ideas???? Please help - I'm getting desperate now :(

Cheers
Rpb
 
If $filename has the correct value, this is probably a problem with the fact that IE reserves the right to ignore headers whenever it feels like it.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
So are you saying that it can not be done in IE then?

Thanks Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top