Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Short answer: you can't. The problem is that HTTP and web browsers don't work that way. You (server) can't "send a file" to a browser, it is the browser that must request the file to you. This said, I see at least two options to do something that works like you expect:
In both approaches you have to consider two caveats: first that the file is created and saved server side, and should not be deleted until the browser downloads it, but consider also that the browser could never start the download. So you should implement some server side mechanism to delete all files older than X minutes/hours/days (depending on your context) or soon or later you'll have the server disk full. The second point to remember is that the files generated in this way are exposed on the internet. If the files can contain sensitive data, you should at least generate them with random names, to reduce the chance of a guess on a sequential naming scheme. Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man." In reply to Re: Send file to Browser
by psini
|
|