[cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Hay
Hi, I'm trying to figure out a good way to download dynamically generated files (mainly PDF files and ZIP files) using CGI-Application. The user directs his browser at a CGI script, rather than a static PDF file or ZIP file, and that script generates the file in question based on various input

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread John Crowley
Steve, I believe the best way would be to redirect the user to a page which has its headers set to the appropriate MIME type. In a simple (non-C::A) CGI, you can use the following line... [ generate your file ] print header(-type => "text/comma-separated-values", -attachment => "do

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Hay
Hi John, John Crowley wrote: Steve, I believe the best way would be to redirect the user to a page which has its headers set to the appropriate MIME type. In a simple (non-C::A) CGI, you can use the following line... Hmm. So I use CGI-Application to generate the file and then send a redirect h

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Adam Gent
> Hi John, > > John Crowley wrote: > > >Steve, > > > >I believe the best way would be to redirect the user to a page which has its > >headers set to the appropriate MIME type. In a simple (non-C::A) CGI, you can > >use the following line... > > > Hmm. So I use CGI-Application to generate the file

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Hay
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 t

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread petersm
Steve Hay <[EMAIL PROTECTED]> wrote > I had a look at the CGI.pm manpage, and it says this about the > -attachment argument: > > "The -attachment parameter can be used to turn the page into an > attachment. Instead of displaying the page, some browsers will > prompt the user to save it to dis

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Eric Andreychek
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Howdy, We just started doing something similar to what you're looking to do. We're using PDF::Reuse to generate our PDF files, are using CGI::Application, and it's running under mod_perl. On Wed, 10 Sep 2003, Steve Hay wrote: > Hmm. So I use CGI-App

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Adam Gent
> 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 me

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Comrie
> I think you're looking for the 'Content-disposition' header here. By > setting it to inline, it suggests to the browser to view it inline, > instead of prompting to save it. I've had success using the following header: Content-Type: application/octetstream\n Content-Disposition: attachment; f

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread David Kaufman
Steve Hay <[EMAIL PROTECTED]> wrote: > > I would rather do it in one step rather than two, and all inside > CGI-Application, if possible. > > It seems a shame to have to step outside of CGI-Application to achieve > something so simple. > > ... The -attachment parameter [...] would > be annoying for

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Eric Andreychek
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Howdy, On Wed, 10 Sep 2003, Steve Comrie wrote: > > I think you're looking for the 'Content-disposition' header here. By > > setting it to inline, it suggests to the browser to view it inline, > > instead of prompting to save it. > > I've had succes

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Hay
Eric Andreychek wrote: On Wed, 10 Sep 2003, Steve Comrie wrote: You should be able to use the argument of 'none' to the CGIApp header_type() method. --- my $filename= 'the_pdf_file.pdf"; my $output = get_pdf_contents(); my $header= "Content-Type: application/octetstream\n";

[cgiapp] Re: How to download a dynamically generated file

2003-09-10 Thread Mark Stosberg
In article <[EMAIL PROTECTED]>, Steve Hay wrote: > --000705070203000702050302 > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > Content-Transfer-Encoding: 7bit > > Hi, > > I'm trying to figure out a good way to download dynamically generated > files (mainly PDF files an

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Comrie
> You had asked for a way to send the PDF a few pieces at a time to > avoid having the entire file in memory at once. Setting > '$ENV{CGI_APP_RETURN_ONLY}', in combination with passing 'none' into > header_type(), does exactly that :-) Eric, I think you're confusing me with Steve Hay, who origina

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Steve Hay
Steve Comrie wrote: Setting $self->header_type('none'); followed by printing the headers yourself and then opening a file in the run-mode and printing it line by line and finally followed by return ''; *should* hypothetically solve the problem without relying on undocumented CGIApp features. Exact

Re: [cgiapp] How to download a dynamically generated file

2003-09-10 Thread Eric Andreychek
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Howdy, On Wed, 10 Sep 2003, Steve Comrie wrote: > > You had asked for a way to send the PDF a few pieces at a time to > > avoid having the entire file in memory at once. Setting > > '$ENV{CGI_APP_RETURN_ONLY}', in combination with passing 'none' into

[cgiapp] Re: How to download a dynamically generated file

2003-09-10 Thread Mark Stosberg
In article <[EMAIL PROTECTED]>, Steve Comrie wrote: > > Setting $self->header_type('none'); followed by printing the headers > yourself and then opening a file in the run-mode and printing it line by > line and finally followed by return ''; *should* hypothetically solve the > problem without rely