Hi guys,
I'm trying to get a script to download a file through a Perl script. I've got it working perfectly, up to the part where it actually does the download;
print qq{Content-Transfer-Encoding: 'binary'\n};
print qq{Content-Length: $file_size\n};
print qq{Content-Type: $file_mime;\n};
print qq{Content-Name: "$file_name"\n};
print qq{Content-Disposition: attachment; filename="$path"\n\n};
open(FILE,$path);
binmode(FILE);
my $line;
while (defined ($line = <FILE>)) {
print $line;
}
close(FILE);
Basically, the problem I am having... is the actual name of the document itself. Currently, whenever you try and download... it comes up as "download[1].cgi" ... and I can't for the life of me, work out how to change it to the real filename :(
Probably something really stupid, so sorry in advance <G>
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
I'm trying to get a script to download a file through a Perl script. I've got it working perfectly, up to the part where it actually does the download;
Code:
print qq{Accept-Ranges: bytes\n}; print qq{Content-Transfer-Encoding: 'binary'\n};
print qq{Content-Length: $file_size\n};
print qq{Content-Type: $file_mime;\n};
print qq{Content-Name: "$file_name"\n};
print qq{Content-Disposition: attachment; filename="$path"\n\n};
open(FILE,$path);
binmode(FILE);
my $line;
while (defined ($line = <FILE>)) {
print $line;
}
close(FILE);
Basically, the problem I am having... is the actual name of the document itself. Currently, whenever you try and download... it comes up as "download[1].cgi" ... and I can't for the life of me, work out how to change it to the real filename :(
Probably something really stupid, so sorry in advance <G>
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!