Показать сообщение отдельно
Старый 09.06.2002, 09:40
Crazy вне форума Посмотреть профиль Отправить личное сообщение для Crazy Посетить домашнюю страницу Crazy Найти все сообщения от Crazy
  № 8  
Crazy
 
Аватар для Crazy

Регистрация: Dec 2001
Сообщений: 4,159
Берем описание 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;
__________________
GIT d++ s++:++ a C++$ UB++ P++ L+ E+ W+++ N++ w++ O+ M V- t-- 5-- X+ R+++ tv- b+++ D++