Lawrence Statton wrote on 15.12.2004:

>>Hi,
>>
>>I have some content stored within a database, which I want to be
>>saved as a f ile on the user's system when requested. Currently, I
>>generate a temporary fi le (timestamp_fileid.tex) and use a cron
>>job to clean up the directory every 30 minutes:
>
>Using timestamp is a poor technique for forming unique filenames.
>Someday, you *WILL* get two requests in the same second.  Use
>File::Temp.  Even better -- don't use a file at all.  I generate PDF
>and Excel spreadsheets all the time, and I never write them out to
>files.
>
I know, this was just intended as a preliminary solution. It is not in 
production use.

>>How can I make the user's browser
>>
>>a) save the file instead of just printing its content to the screen
>>(as with the header text/plain), so I do not need to use a
>>temporary file
>
>In your headers, you want to put something like
>
>Content-type: application/x-tex Content-disposition: attachment;
>filename="custom-file.tex"
>
The Content-disposition header was what I was looking for. Thank you! I will do 
some testing with these options.

Cheers,

Jan
-- 
These are my principles and if you don't like them... well, I have others. - 
Groucho Marx

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to