NYCPHP Meetup

NYPHP.org

[nycphp-talk] Anyway to force a download of GIF file?

Chris Shiflett shiflett at php.net
Thu Jul 17 17:17:09 EDT 2003


--- FB` <fb at intldef.org> wrote:
> as a solution to a similar problem, we used a combination of a Files
> directive and $PATH_INFO -
> 
> the php script would be, for ex site.com/download (no extension)
> with a Files directive like this in .htaccess:
> 
> <Files download>
>         ForceType application/x-httpd-php
> </Files>
> 
> Then, you pass it the desired image filename like this:
> 
> site.com/download/gifname.gif

I think this trick still works even when the URL is something like:

http://site.com/download.php/gifname.gif

This would save having to use the ForceType directive.

Another trick I have seen used (though I do not know how effective it is) is a
URL like this:

http://site.com/download.php?iesucks=gifname.gif

I've never had to work around this particular problem, but those are the
methods I have seen mentioned when this topic arises.

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/



More information about the talk mailing list