in reply to Need help with downloading

A quick google search returned a PHP varient. Transcribing it into perl and extending the functionality:

#!/usr/bin/perl -w use strict; use File::Type; my $file = $0; print "Pragma: public\n"; # reportedly required print 'Content-Type: ', File::Type->new()->mime_type($file) || 'applic +ation/force-download', "\n"; print "Content-Disposition: attachment;filename=$file\n"; print "Content-Transfer-Encoding: binary\n"; print 'Content-Length: ', -s $file, "\n\n"; open(FILE, "$file"); binmode $_ foreach (*FILE, *STDOUT); print foreach (<FILE>); close(FILE);

Verified to work with Apache on Linux.

UPDATE: Removed unnecessary variables