Entry
replacing the <a href=download file by <a href=cgi which is sending the file, the filename is changed to the script filename
Jul 28th, 2000 03:57
Kirederf,
Thanks to
vincent.oneto
who helped me
My goal was sending a file to download via a cgi
to do so you have to tell the browser the following things
print "Content-type: application/octet-stream\n";
print "Content-Length: $size\n";
print "Content-disposition: filename=$filename\n\n";
open(FILE, "<$filepath") || die;
while(<FILE>)
{ print $_;}
close(FILE);
first you give a type (I don't know if this one is the good one but It
works on every browser I tested on)
Then if you have it you give the length
then the content-disposition which will be the default name of your
downloaded file in the "save as" window.
Hope this will help for others.