in reply to Forcing a Word Document to Download
#!/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; my $dir = '/path/to/file'; my $file = 'file.doc'; open(FILE, "$dir/$file") or die "Error opening file $file: $!"; print $cgi->header( -type => 'application/octet-stream', -attachment => $file, ); while(<FILE>) { print; } close(FILE);
|
---|