frank_2k4 has asked for the wisdom of the Perl Monks concerning the following question:

print $cgi->header(-refresh=>"1;URL=$urlfrank", -type=>'text/html');
My header points to a url which is actually another cgi script. This cgi script essentially cats a file, reads it into a variable, and returns the file contents to the browser. The problem I am having is that when the save as popup box appears on my screen the filename does not match the filename that I read the contents from. Meaning I get the correct file contents, however it seems like the browser is returning the name of the script or application as opposed to the filename. This only happens when I use a refresh header. If I point to my cgi script in my browser, it gives me a popup box with the correct filename. Seems like I am having a problem with the refresh header.

Replies are listed 'Best First'.
Re: Cannot get correct filename using CGI
by xtype (Deacon) on Jul 15, 2004 at 21:58 UTC
    Perhaps you are looking for:
    -Content_Disposition=>"filename=filename.txt"

    update: why are you using refresh? Is it a splash screen? If not, you could simply:
    print $cgi->redirect("$urlfrank");
    ...and then allow the second cgi to name the file in the output.

    -xtype