Phoenix.pm: Perl CGI autodownload

Phaedrus phaedrus at endless.org
Thu Sep 30 15:57:38 CDT 1999


Mark:

Common problem. It's a Windows-ism. IE for the PC ignores the content type
header, and goes by the extention. However, Windows isn't too smart about
about being stupid, so you can fool it, like this:

Have the download link, link to your cgi program, but pass, as the query
string, something like this:
makewindowshappy=fn.ppt
So the URL might be something like this:
/cgi-bin/downloader.cgi?makewindowshappy=fn.ppt

Windows will see the '.ppt' extention on the URL, and use PowerPoint (if
the client has it on their system) if the user picks to 'Run' the
download.

goodluck!
-scott walters


On Thu, 30 Sep 1999, Mark A. Sharkey wrote:

> Date: Thu, 30 Sep 1999 10:13:18 -0700
> From: Mark A. Sharkey <mark at wcws.com>
> Reply-To: phoenix-pm-list at happyfunball.pm.org
> To: phoenix-pm-list at happyfunball.pm.org
> Subject: Phoenix.pm: Perl CGI autodownload
> 
> Hello,
> 
> Our Perl script successfully auto-downloads files for
> clients that use Netscape for a browser, or IE on a Mac for
> a browser.  However, the script does not seem to work
> properly for IE4 on a Microsoft platform when trying to
> download non-text files.
> 
> For example, the script cannot successfully download a
> PowerPoint file through the browser when using IE on
> Windows95.
> 
> 
> Does anyone have a snippet of code that will download
> various file types through the browser?  Something similar
> to this (but actually works):
> 
> print "Content-Disposition:
> attachment;filename=\"$file\";\n";
> print "Content-type: application/vnd.ms-powerpoint\n\n";
> 
> 
> Thanks.
> 
> 
> Mark
> -- 
> @--------------------------- at -----------------------@
> | Mark A. Sharkey           | mailto:mark at wcws.com  |
> | World Class Web Sites     | http://www.wcws.com   |
> |                           | 800 844 4434          |
> | Custom CGI Scripts        | 480 461 9765          |
> | Perl PHP MySQL JavaScript | 480 461 9312 (fax)    |
> @--------------------------- at -----------------------@
> 




More information about the Phoenix-pm mailing list