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
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 =
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
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
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 disk. The
-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
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;
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 PDF files
-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 success using
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;
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 and ZIP
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 originally
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.
-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
14 matches
Mail list logo