Getting "POST requires exactly one file upload per request" in AWS Gateway
<p>I have created a bucket in S3 and created an API at Gateway for that. I try to POST a file to the s3 bucket.</p>

<p><strong>My request is; (I used Chrome REST client/SOAUPUI etc)</strong></p>

<pre><code>POST / HTTP/1.1
HOST: lob-test-api.s3-ap-southeast-2.amazonaws.com
content-type: multipart/form-data; boundary=----WebKitFormBoundarywLoiMiBUjfoSuUjG
content-length: 157

------WebKitFormBoundarywLoiMiBUjfoSuUjG
Content-Disposition: form-data; name="fileUpload6"

[object Object]
------WebKitFormBoundarywLoiMiBUjfoSuUjG--

....
</code></pre>

<p>The Response I get is;</p>

<pre><code>&lt;Error&gt;
&lt;Code&gt;InvalidArgument&lt;/Code&gt;
&lt;Message&gt;POST requires exactly one file upload per request.&lt;/Message&gt;
&lt;ArgumentName&gt;file&lt;/ArgumentName&gt;
&lt;ArgumentValue&gt;0&lt;/ArgumentValue&gt;
&lt;RequestId&gt;83C6F58DCEA9A85B&lt;/RequestId&gt;
&lt;HostId&gt;w3gxLb1CDJ8xPMUkhOH8sezIYC/OP/uaUHUvBlFQCXg453dkkTivjdhfb/uOZCY5KpUOoqfUeBA=&lt;/HostId&gt;
 &lt;/Error&gt;
</code></pre>

<p>I routed the request through tcpmon, and edited the  content-type header multipart/form-data  boundary to;
<code>------WebKitFormBoundarywLoiMiBUjfoSuUjG</code> . But still I get same error.</p>

<p>Why do I get this error?</p>

<p>It is a simple API to handle POST request.</p>

<p><strong>Edit:</strong></p>

<p><strong>Request</strong></p>

<pre><code>Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryS280VEmBfACBZzzD
Content-Length: 8063
Source message

POST / HTTP/1.1
HOST: lob-test-api.s3-ap-southeast-2.amazonaws.com
content-type: multipart/form-data; boundary=----WebKitFormBoundaryS280VEmBfACBZzzD
content-length: 8063

------WebKitFormBoundaryS280VEmBfACBZzzD
Content-Disposition: form-data; name="fileUpload1"; filename="persistence.xml"
Content-Type: text/xml

&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;


&lt;/persistence&gt;
------WebKitFormBoundaryS280VEmBfACBZzzD--
</code></pre>

<p><strong>RESPONSE</strong></p>

<p>&lt;</p>

<pre><code>?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;Error&gt;
&lt;Code&gt;InvalidArgument&lt;/Code&gt;
&lt;Message&gt;POST requires exactly one file upload per request.&lt;/Message&gt;
&lt;ArgumentName&gt;file&lt;/ArgumentName&gt;
&lt;ArgumentValue&gt;0&lt;/ArgumentValue&gt;
&lt;RequestId&gt;E79843688D0A0D29&lt;/RequestId&gt;
&lt;HostId&gt;CbCQjV9Y7I1ocpd9QKhpAEEfH+io31NYZwhadPKTQRPLAjIvRa6w1uSg2API7DBwEieZM99wfGg=&lt;/HostId&gt;
 &lt;/Error&gt;
</code></pre>