JMeter File Upload - Raw contents

187 Views Asked by At

I have a very peculiar scenario where the raw data of the file has to be sent. I have tried following options and still wasn't successful.

  1. Http Request with form-data disabled but still its sending as multi-part which is not acceptable by the system
  2. Sending the file contents in request body by following methods . They were successful however the file uploaded was encoded in some format so the MD5 hash of the original file and uploaded file doesn't match. Hence the uploaded file looked different from original
    • FileToString Method
    • Reading the file using HTTP request . Capturing the response and passing to the body of File upload request
  3. Using Https Raw data . Since its https request, it cannot be used.
  4. All possible encoding formats available but nothing worked as the application just expects the raw data without any encoding.
1

There are 1 best solutions below

0
Dmitri T On

You're supposed to provide an example successful request and the file you're uploading, it can be captured using a sniffer tool like Wireshark or Fiddler, only this way we'll be able to come up with the relevant JMeter configuration required to replicate the request.

In the mean time I can only suggest trying recording the request using JMeter's HTTP(S) Test Script Recorder

  1. Start JMeter's HTTP(S) Test Script Recorder
  2. Import JMeter's certificate into your browser (or system certificates storage if the upload is being performed by other application), see HTTPS recording and certificates chapter of JMeter's documentation on HTTP(S) Test Script Recorder
  3. Copy the file you're going to upload to "bin" folder of your JMeter installation (or JMeter's current working directory if you're launching it from a desktop shortcut or whatever), see Recording File Uploads with JMeter for more details
  4. Perform the upload in the browser (or other application)
  5. JMeter should intercept the request and generate proper HTTP Request sampler and HTTP Header Manager