CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Sending file from CGI Perl script ... again

 



wilsonr
Deleted

Jun 27, 2000, 11:53 AM

Post #1 of 2 (643 views)
Sending file from CGI Perl script ... again Can't Post

Hi all,

I have a Perl CGI script using the following code (thanks to Kanji) that sends a file to the users browser ...
----------------- code ---------------------
if ( open FILE, "/path/to/some.gif" ) { print "Content-Type: application/octet-stream\n\n", <FILE>; close FILE;} else { print "Content-Type: text/plain\n\n", "Couldn't open some.gif because: $!\n";}
--------------------------------------------
...however, when the user is prompted to download the file, the name of the file always defaults to the name of the Perl script sending the file.

Is there any way around this so that the name of the file is always the name of the file being downloaded?

Best regards

Rod Wilson



Kanji
User

Jun 27, 2000, 9:13 PM

Post #2 of 2 (643 views)
Re: Sending file from CGI Perl script ... again [In reply to] Can't Post

Give the script the same name as the file it sends, or -- if you choose which file to send via arguments -- use path info (/cgi-bin/script/a.gif) vs query string (/cgi-bin/script?a.gif).

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives