> Adam Gent wrote:
>
> >Hi,
> >
> >There is no reason why it can not be all done within the C::A.
> >
> >If the run mode generates the file and saves it to disk as a temporary
file.
> >The run mode can then output the correct header.
> >
> >
> What would the "correct header" there be?
>
> Do you mean redirect the client to the temporary file that has been
> generated?
>
> The other thing that I wanted to do was clean up the temporary file that
> was created after it has been sent to the user.  This is achievable if
> C::A's run() method outputted the file itself (the cleanup code could
> then go in teardown()), but not if it just sent a redirect header.
>
> - Steve
>
>

Hi,

You can change the header in C::A to output the header

print header(-type => "text/comma-separated-values",
     -attachment => "download.csv");

Through the header_props method is C::A, which goes via CGI.pm

 $webapp->header_props(-type=>'image/gif',-expires=>'+3d');

So you can then do

 $webapp->header_props(-type => "text/comma-separated-values",
     -attachment => "download.csv");

Should work fine.

You can also do this for zip and pdf files, if you set the correct header
type,

ie.    application/zip
        application/pdf

Adam


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.517 / Virus Database: 315 - Release Date: 08/09/2003


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to