Required MultipartFile parameter 'file' is not present in Jmeter



  • 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

    --hHjQWI9uUQ3sP-EYqUUzibD0nxN07P--

    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



  • 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.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2