[Belfast-pm] Files sent for download via CGI

Simon McCartney simon at asidua.com
Tue May 4 09:02:36 CDT 2004


On Tue, May 04, 2004 at 02:26:08PM +0100, Andrew Dunn wrote:
> Hi Simon,
> 
> You can actually set the "Content-Disposition:" header to use a specific
> filename instead of the name of the script.
> 
> Something like this should work:
> 
>    Content-disposition: filename="sheet.xls"
> 
> Apparently though with CGI.pm you can use the header method to behave
> directly as you want.
> 
>    print $query->header(-type=>'application/octet-stream',
>                         -attachment=>'sheet.xls');
> 
> I've never tried that second method myself though but it was taken from
> the CGI manual.
> 
> Hope that helps,

It does indeed, thanks, I guess I should have looked harder through the
CGI.pm documentation.  Both methods work a treat.


-simonm (E: simon at asidua.com W: +44 28 9072 5060 M: +44 7710 836915)
I'm not an alcholic, I'm a liquid crusader fighting the evils of the
tee-total taliban.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/belfast-pm/attachments/20040504/9e2539cc/attachment.bin


More information about the Belfast-pm mailing list