0
votes

Jmeter v.5.1.1 r1855137

I'm trying to upload .xlsx file using multipart/form-data request type, however, I'm getting different errors such as:

  • multipart body length limit 16384 exceeded;
  • unexpected end of stream, the content may have already been read by another component;

These are parameters for POST request that should upload our .xlsx file: screenshot_1

Method:                            POST;
Use multipart/form-data checkbox:  unchecked;
File Path:                         C:\temp\5000Lanes.xlsx;
Parameter Name:                    file;
MIME Type:                         application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

These are Header Manager parameters screenshot_2

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

Note that Body Data and Parameters left empty screenshot_3


So, please help me to figure out what is wrong in configuration to make upload successful ?

2

2 Answers

0
votes

After 1 day of struggle I've found the solution and now the upload is successful.


So, using the same configs that were specified in my question the only thing you need to add is to proceed to 'Advanced' tab of your HTTP Request and set 'Implementation' parameter to Java https://i.stack.imgur.com/GtEDz.png

0
votes
  1. Remove Content-Type header from the HTTP Header Manager

  2. Tick Use multipart/form-data box for the HTTP Request sampler:

    enter image description here

Going forward be aware that you don't have to manually build file upload requests (as well as any other requests), you can record the file upload event using HTTP(S) Test Script Recorder, just make sure to copy the file to "bin" folder of your JMeter installation otherwise JMeter won't be able to properly catch the request and generate correct HTTP Request sampler, see Recording File Uploads with JMeter for more details

  1. According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.3 (or whatever is the latest stable version available at JMeter Downloads page) on next available opportunity