Home > database >  File upload request failed in Jmeter even after following correct steps
File upload request failed in Jmeter even after following correct steps

Time:07-16

I have followed below steps to upload file in jmeter but it didn't worked. It throws Sorry, an error occurred while trying to execute your request. Please try again I have attached screenshots for more details.

  1. Enabled Use multipart/form-data
  2. Copied the file which is going to upload in /bin directory
  3. I have tried with check/Uncheck Use multipart/form-data but no luck

In my HTTP request I passes action_id=1203 as Query parameters and in Form Parameters I am Passing other parameters like msgId, fieldId etc. but from screenshot you can observe when I execute that it passes my whole form parameters in just one single key of "msgId" I don't know why?

This are the headers which I pass enter image description here

My Request with Query and Form parameters enter image description here

File upload tab of http request enter image description here

After execution request failed with this output. Here it passes all form params in single "msgId" key enter image description here

F12 - Network request of Webpage form parameters (checked manually on web it works fine. Problem is in my jmeter request) enter image description here

CodePudding user response:

Just record the file upload using JMeter's HTTP(S) Test Script Recorder and it will generate the relevant HTTP Request sampler and HTTP Header Manager configuration which can be later on correlated/parameterized.

The only thing you need to do is to copy the file you're uploading to "bin" folder of your JMeter installation before recording. File path can be changed to whatever you want afterwards.

Also according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.5 (or whatever is the latest stable version which is available at JMeter Downloads page) as soon as possible.

  • Related