undef $/; # Slurp whole file into scalar, # otherwise only to first \n my $file = "ms.tif"; open(READ, $file) || die "Yada yada"; binmode(READ); my $buffer = ; close(READ); binmode(STDOUT); print "Content-Type: image/tiff\n"; print "Content-Transfer-Encoding: binary\n" # Was base64 print "Content-Disposition: attachment; filename=ms.tif\n"; print "Content-Length: ", -s $file, "\n\n" #Show progress bar print $buffer;