Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Temp file strategy

by signal9 (Pilgrim)
on Sep 17, 2005 at 13:27 UTC ( [id://492859]=note: print w/replies, xml ) Need Help??


in reply to Re: Temp file strategy
in thread Temp file strategy

"Is it possible to not create the temp file until the user selects to download it...?"

Sure, just output your preferred filetype w/ proper MIME type just like you would a web page. Nothing fancy at all, and I've been known to do this.

"I don't think any of the temp file solutions written above will work across invocations of your CGI..."

Reread the above example. Files are deleted after an arbitrary "timeout". We do this alot for CSV downloads of reports where I work. Usually we do 24hrs. Sure, if someone runs a report, but doesn't click on the CSV link until sometime tomorrow the file will be gone. I don't think that's unreasonable, but it's really up to you how long the file sticks around.

Of course, these are hand-rolled solutions. I think I'm going to have to look into the File::Temp module folks keep talking about.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://492859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2025-06-20 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.