NYCPHP Meetup

NYPHP.org

[nycphp-talk] filename for forced download

Jon Baer jonbaer at jonbaer.com
Fri May 19 21:35:06 EDT 2006


Two things ..

Never did this but, what happens if you quote out the filename,  
anything?
header( "Content-Disposition: attachment; filename=\"$fname\"" );

Also what version of IE?  This had been noted to be a security issue  
in regards to spoofing in previous editions and seems their quickfix  
was to do something like this.

You can try "application/octet-stream" w/ the needed extension to see  
if the save dialog prompts the correct filename.

- Jon

On May 19, 2006, at 9:18 PM, Michael Southwell wrote:

> 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
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>




More information about the talk mailing list