I am using the html <INPUT Type="file" name="document"> tag to upload files via Perl to a directory.
Text and HTML files upload fine, but .doc and .pdf files somehow get corrupted. The file size is the same, but it will not open or opens but is blank.
The Perl for writing the file is:
open UPLOADFILE, "> $base_dir/$file_name" || die "Couldn't open FH for output";
while ( <$upload_filehandle> ) {
print UPLOADFILE;
}
Does anyone know what might be happening? Is this a plain text vs binary data issue?
All feedback welcome!
Text and HTML files upload fine, but .doc and .pdf files somehow get corrupted. The file size is the same, but it will not open or opens but is blank.
The Perl for writing the file is:
open UPLOADFILE, "> $base_dir/$file_name" || die "Couldn't open FH for output";
while ( <$upload_filehandle> ) {
print UPLOADFILE;
}
Does anyone know what might be happening? Is this a plain text vs binary data issue?
All feedback welcome!