[Belfast-pm] Files sent for download via CGI
Andrew Dunn
andy at luibh.com
Tue May 4 08:26:08 CDT 2004
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,
Andy.
Simon McCartney said:
> Afternoon folks,
>
> I'm using Spreadhseet::WriteExcel to create an Excel version of a
> report, everything works sweetly, however when the file get's downloaded
> (by the punter clicking on the cgi link) you have to rename it from
> something.pl to whatever.xls.
>
> I'm using CGI.pm at the moment, is there any way to generate a filename
> and send it in the HTTP headers, over riding the link filename?
>
> Thanks,
>
> Simon.
>
> -simonm (E: simon at asidua.com W: +44 28 9072 5060 M: +44 7710 836915) $
> cat legs
> cat: cannot open legs
--
Luibh.com
E: support at luibh.com
W: http://www.luibh.com
Web Hosting and Development
More information about the Belfast-pm
mailing list