NYCPHP Meetup

NYPHP.org

[nycphp-talk] filename for forced download

Michael Southwell michael.southwell at nyphp.org
Fri May 19 21:18:02 EDT 2006


I have run into a problem with the default filename of a 
forced-download file, on (of course) Internet Explorer. The script 
works perfectly, and on smart browsers like Firefox or Opera or 
Mozilla the default filename is indeed the name of the incoming file, 
as it should be.  But on IE the name is defaulting to _download 
(which may be a reflection of the fact that the operative script is 
named _download.php), even though the Disposition header is correctly 
(according to my tests) naming the file.  Here are those headers:
============
header( "HTTP/1.1 200 OK" );
header( "Content-Length: $fsize" );
header( "Content-Type: application/force-download" );
header( "Content-Disposition: attachment; filename=$fname" );
header( "Content-Transfer-Encoding: binary" );
============
Now in fact the file is not binary, so possibly the encoding should 
not be binary (advice?), but surely that has nothing to do with the 
default name problem. Any ideas on how I can force the correct name 
into IE?  Thanks in advance.

Michael Southwell, Vice President for Education
New York PHP
http://www.nyphp.com/training - In-depth PHP Training Courses 




More information about the talk mailing list