Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to upload a file using AJAX. Unfortunately, the XMLHttpRequest.send in Safari sends the file without adding multipart form boundaries (http://lists.macosforge.org/pipermail/webkit-unassigned/2009-July/119008.html). As a result, CGI.pm dies with the following error:

"Malformed multipart POST: data truncated"

How can I get around this? It seems like the best way is to modify my JavaScript so that it sends correct form boundaries; unfortunately, I'm not sure that that is possible in this case. How can I change CGI.pm to accept a "multipart" form POST that only includes data for a file without the boundary string?

Thanks in advance,
--TWH
  • Comment on AJAX file upload and "malformed multipart POST: data truncated"

Replies are listed 'Best First'.
Re: AJAX file upload and "malformed multipart POST: data truncated"
by Anonymous Monk on Oct 22, 2010 at 02:48 UTC
    How can I change CGI.pm to accept a "multipart" form POST that only includes data for a file without the boundary string?

    You can't, and you really don't want to. The internet relies on standards, and its the rogues that must change, not the other way around.