title: Uploading file to rest API using JMeter
body: <p>Note - I have checked <a href="https://www.blazemeter.com/blog/testing-advanced-rest-api-file-uploads-jmeter" rel="nofollow noreferrer">BlazeMeter Tutorial</a> which uploads doc as Body Data while I use File Upload tab.</p>
  
  <p>Here is how my request looks - </p>
  
  <p><a href="https://i.stack.imgur.com/3K7gn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3K7gn.png" alt="enter image description here"></a></p>
  
  <p>On execution I get following Request -</p>
  
  <pre><code>POST https://xxx
  
  POST data:
  &lt;actual file content, not shown here&gt;
  
  [no cookies]
  
  Request Headers:
  Connection: keep-alive
  Content-Type: multipart/form-data
  Accept-Language: en-US
  Authorization: bearer &lt;&gt;
  Accept: application/json
  Content-Length: 78920
  Host: test-host
  User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
  </code></pre>
  
  <p>And the request fails with 400 error -</p>
  
  <pre><code>Response code: 400
  Response message: Bad Request
  </code></pre>
  
  <p>Since I am able to carry out file upload using curl, I assume that I missed the some configuration with JMeter. Curl looks as - </p>
  
  <pre><code>curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Authorization: Bearer &lt;&gt;' -F upload_file=@"test.pdf"  'https://xxx'
  </code></pre>
  
  <p>What did I miss in JMeter file upload?</p>