in reply to Re^5: Perl CGI to download files via web browser
in thread Perl CGI to download files via web browser
use CGI; my $html= new CGI; my $file= $html->param('a'); my $filepath= "/var/www/upload/$file"; print ("Content-Type:application/x-download\n"); print "Content-Disposition: attachment; filename=$file\n\n"; open FILE, "< $filepath" or die "can't open : $!"; binmode FILE; local $/ = \10240; while (<FILE>){ print $_; } close FILE; #unlink ($filepath);
|
|---|