Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a download script problem

Status
Not open for further replies.

gchen

Programmer
Nov 14, 2002
174
0
0
US
Hi,

i am working on a download script (PERL) and i encountered a problem where i try to do two things -

after visitors entered their name, email address, the srcipt supposes to 1) echo a thankyou page and 2) let the visitor to download the file.

what i did in my script is like this...

...
print "thank you!\n\n";
print "Location: $download/$file";
...

but i got below at client side --

...

thank you

Location: the/actual/value/of/the/file

...

and this is not what i want.

Can someone help?

thanks a lot!

Gary
 
Did you want this to come out as a hyperlink so that the user can click on the link in order to download the file?

If so:
Code:
print "thank you!\n\n";
print "Location: <a href=\"[URL unfurl="true"]http://www.url.com/".$download."/".$file."\">Click[/URL] Here to Download File<\/a>";
Maybe give an example of what you want the actual output to be...

Rob Waite
 
Location is a header, as such it needs to come before any real content.

You print 'thank you' before which means you already printed the headers.

If you really want to 'auto download' with a thank you message use a meta redirect tag with a '0' refresh value. That will load your thank you page then redirect to the file for immediate download.

If you just want it to download put hte Location tag into your headers.
 
I would forget about the header, redirect/post to a THANK YOU page and use a regex if you must to break your file name and location into a link.

I have to do this all the time.
 
Folks,

Thank you so much for the inputs and comments.

I am hesitated to use redirect because the url will be visible when people do a right click and "view source". that's why i want to use location at header but it gives me no option to say "thank you".

other than above, any other suggestion that i can have a "thank you" page yet the download will happen automatically without revealing the url where i file is. i want to avoid people coming direcly to download the file bypassing the download request process.

Thanks a million!
 
This was also asked in thread452-954117 where direction was suggested to have the redirect go to the same perl script with the file information appended as a parameter and the download start.

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top