in reply to Improving a File Download Script

As mentioned before you sould sure binmode, but I believe you should also use read like this:
open(DLFILE, "<$file_location/$id") || Error('open', 'file'); binmode print "Content-Type:application/x-download\n"; print "Content-Disposition: attachment;filename=$filename[0]\n\n"; my $data; while (read DLFILE, $_, 1024) { print $data; }
close (DLFILE) || Error ('close', 'file');