in reply to File Upload

Do you get an error message? I don't see the error being reported anywhere. I suggest putting $! in the error strings so you can see the reason for a failure. You don't really need to check the return value of the print. Writing to a local file will rarely fail; the common problem of disk full will be reported if you check the return of the close.

Also, check $q->cgi_error() at the top. If CGI.pm can't parse the POST, then it will show up there. And check that $filename is not undef, which happens with the missing form param.

Another thing to try is instrument the read loop. Print out the bytesread. This will give a good indication of what is being read.