How to Post Binary file (attachment) as a request body in JMeter

Viewed 769

As in Postman, where the binary file itself could be attached as a request body to perform a Post operation, I am trying to attach a binary file in JMeter via File upload option. But it is not working. The input binary file is not deducted and it is not sent as a request body.

Here is what I have tried, In the HTTP request, I used File upload option to attach the binary file from my Local by giving MIME type as application/octet-stream and by leaving Parameter field as empty.

What am I doing wrong here? Can a solution be provided on this on how else could I pass a binary file as an input in JMeter?

jmeter_Req

1 Answers
  1. leaving Parameter field as empty - I don't think it's valid configuration, most probably you need to specify the name of associated HTML Input

  2. I would also try ticking Use multipart/form-data box

    enter image description here

Going forward I would recommend just recording the file upload even using JMeter's HTTP(S) Test Script Recorder, just make sure to copy the file to JMeter's "bin" folder prior to executing the request in browser, this way JMeter will be able to intercept the request and properly generate the HTTP Request sampler and HTTP Header Manager. See Recording File Uploads with JMeter article for more information if needed

More information:

Related