Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How do i return a file with CGI and suggest a file name to 'save as'

by cLive ;-) (Prior)
on Jul 20, 2001 at 22:33 UTC ( #98491=note: print w/replies, xml ) Need Help??


in reply to How do i return a file with CGI and suggest a file name to 'save as'

use CGI;

when printing the file to the browser, use the following header:

print $query->header(-type=>'application/octet-stream', -attachment=>'foo.doc');
  • Comment on Re: How do i return a file with CGI and suggest a file name to 'save as'
  • Download Code

Replies are listed 'Best First'.
Re: Answer: How do i return a file with CGI and suggest a file name to 'save as'
by cLive ;-) (Prior) on Jul 21, 2001 at 01:45 UTC
    PS - this doesn't work with all browsers. So, if you can, append your script URL as follows when you call it (this seems to sort out most situations):
    http://my.domain/url/of_script.cgi/suggested_filename
    where 'suggested_filename' is the name you want the file saved as.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2021-12-03 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?