You can find multiple forums showing the image upload functionality with JMeter. However, this is not an easy task, as you have to go through multiple forum threads to find a solution. Here, you can find an easy way of ensuring successful image upload with JMeter.
In order to do that, you need to follow the following steps.
- Set up the JMeter. Here, you need to set the HTTP request to ‘POST’ method and check the box saying ‘Use multipart/form-data for POST.
- In the ‘Send Files With the Request’ window, consider the following points.
- File Path: You need to provide the full file path with the file name in it
- Parameter Name: It must ne the exact name attribute
- Mime Type: Ensure you have a correct Mime type. Some of the common Mime type includes image/gif, image/jpeg, image/png, image/svg + xml, image/tiff, image/vnd.djvu, etc.
- You can upload several files by providing the parameter in the script. For this, you need to write ${imageName} instead of the file name in the ‘Send Files With the Request’ window.
- Add a ‘CSV Data Set Config’ element to the top of the script. This will read the name from a CSV file. For example, image1.png,image2.png,image3.png
- You can also upload multiple files by choosing ‘False’ at ‘Recycle on EOF’ and ‘True’ at ‘Stop thread on EOF’.