I am using JMeter to perform file upload test.

I have created an HTTP request to upload the file but I am getting 400 Error.

Following is the data I am using to perform the test.

  1. The file type is CSV and verified the same by keeping the file in Jmeter bin folder and outside as well.
  2. HTTP request which is getting sent to the Server.

"POST http://staging.server.com/app/abc/upload/nextech"

POST data: --hHjQWI9uUQ3sP-EYqUUzibD0nxN07P Content-Disposition: form-data; name="file"; filename="appointments - Sheet1.csv" Content-Type: multipart/form-data Content-Transfer-Encoding: binary


Cookie Data: JSESSIONID=F12BCDF8EC1BD4B52E18716A174FB347

Request Headers:

Connection: keep-alive

Accept: /

Origin: http://staging.server.com

X-CSRF-TOKEN: 44cf8a25-2157-4086-bcd6-828b827f3efa

Content-Type: multipart/form-data;boundary=----WebKitFormBoundary9wyB2Bt4GSs1EYtR

Referer: http://staging.server.com/app/schedule Content-Length: 952

Host: staging.server.com

User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_171)".

File Path in the request is: "D:\Jmeter3\apache-jmeter-3.2\bin\appointments - Sheet1.csv", ParameterName: file, MIME Type:multipart/form-data

Request Header:
Accept /

Origin http://staging.beepermd.com

X-CSRF-TOKEN ${extractedCSRF}

Content-Type multipart/form-data;boundary=----WebKitFormBoundary9wyB2Bt4GSs1EYtR

Referer http://staging.server.com/app/schedule

  • What is the difference between your Request headers and Request header sections? It also seems that you have unsubstituted token there ${extractedCSRF}
    – Alexey R.
    Oct 25, 2018 at 13:05
  • In request header 1, I have shown the data after the request is sent to the server. In request header 2, I am showing data of the header, which is I am using.
    – Anil Kumar
    Oct 25, 2018 at 13:10
  • @AlexeyR. ${extractedCSRF} is a variable which is carrying the value of csrf token.
    – Anil Kumar
    Oct 25, 2018 at 13:13

1 Answer 1


If you want to upload the file my expectation is that you should be using Files Upload tab of the HTTP Request sampler

  1. Tick User multipart/form-data box
  2. Switch to Files Upload tab
  3. Configure File Path, Parameter Name and MIME Type sections:

    enter image description here

  4. Remove Content-Type header from the HTTP Header Manager - assuming above setup JMeter will generate proper boundary value itself:

    enter image description here

Be informed that according to JMeter Best Practices you should always be using the latest version of JMeter (which is JMeter 5.0 as of now) so make sure to visit JMeter Downloads page and fetch the latest available version from there asap.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.