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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

