Берем описание CGI.pm и видим, что твой код основан на варианте для ТЕКСТОВЫХ файлов. Возьми вариант для двоичных.
Цитата:
When the form is processed, you can retrieve the entered filename by calling param().
$filename = $query->param('uploaded_file');
where "uploaded_file" is whatever you named the file upload field. Depending on the browser version, the filename that gets returned may be the full local file path on the remote user's machine, or just the bare filename. If a path is provided, the follows the path conventions of the local machine.
The filename returned is also a file handle. You can read the contents of the file using standard Perl file reading calls:
 Код:
# Read a text file and print it out
while (<$filename>) {
print;
}
 Код:
# Copy a binary file to somewhere safe
open (OUTFILE,">>/usr/local/web/users/feedback");
while ($bytesread=read($filename,$buffer,1024)) {
print OUTFILE $buffer;
}
close $filename;
|