Link to home
Start Free TrialLog in
Avatar of didede
didede

asked on

Change default filename when downloading from cgi

Hi,

I am using a cgi script (perl with windows nt) to send file to client browser (download fonction).

The problem is : when the window open (save as), the default name of the file is the name of the cgi program.

how can i change the default name before the "save as" window open ??

I use this code to send the file :

 print "HTTP/1.0 302 Found\n";
 print "Content-type: multipart/x-zip\n\n";
 
 binmode STDOUT;
 
 open (FILE, $file);
 
 binmode(FILE);
 read (FILE, $buffer, -s $file);
 print $buffer;

 close(FILE);

thanks
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PS: the filename may have to be in quotes:
Content-disposition: inline; filename="myfile.zip"

and you might want to use this too:
Content-type: multipart/x-zip; name="myfile.zip"

Michel