Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re-direct after Download problem

by Errto (Vicar)
on Aug 21, 2007 at 00:53 UTC ( #633977=note: print w/ replies, xml ) Need Help??


in reply to Re-direct after Download problem

What you're trying to do is not directly possible. Your CGI script can send the user a file or redirect them to another URL, but not both.

Also this script is insecure, if for no other reason than that it will allow the user to read any file on the server machine so long as the web server process has access to it. Instead of doing that, have your script form the path to the file as you are doing, then use redirect to send the user to the actual URL of the file so they can download it directly, something like

print $cgiobject->redirect("/$filedir/$filename");
This has the additional benefit of giving the user proper headers for things like Content-type, Last-Modified etc.

Update: made less punchy.


Comment on Re: Re-direct after Download problem
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-10-24 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (133 votes), past polls