1) You're using CGI, so use CGI->header to print http headers.
2) Malformed multipart POST sounds like browser bug (its sending malformed data). To confirm, verify/upgrade your CGI, try different browser combination... eventually you will have to use http://wireshark.org