in reply to CGI: Uploaded binary file is corrupted

The CGI part looks correct. One problem is that you are reading the file line by line. If it is binary file, you want to read it all in one go. Make sure to check that the content-length is valid and you read the full length. Either read or brackets with $/ undefined will work.
read $fh, $contents, $length; $/ = undef; $contents = <$fh>;
The way to debug the problem is check that the file is valid at various stages of process. Check the file before upload, check the temporary file, check the contents read into memory, check the value in the database.

Replies are listed 'Best First'.
Re: Re: CGI: Uploaded binary file is corrupted
by neilwatson (Priest) on Oct 30, 2002 at 18:15 UTC
    Turns out I'm and idiot. I had the database field set to blob, which was to small. Mediumblob works well.

    Thanks for the help.

    Neil Watson
    watson-wilson.ca