handling file upload in jmeter

File Upload in JMeter

Last updated on

Handling File Upload in JMeter

Quite often we are required to script scenarios where uploading files to server functionality is required to be load tested. In this tutorial, we will see how to handle file upload in JMeter.

Configure the HTTP Request Sampler with the following detail in order to perform the file upload action-

  • Server Name and Path parameters will be name of the server and its Path
  • File upload in JMeter will be a HTTP Post request. So, we would be required to select POST Method in HTTP Request sampler.
  • Uploading file to server requires building a multipart/form-data request. For this we will check multipart/form-data for POST checkbox in HTTP Request sampler.File Upload in Jmeter

Next, we are required to click on the Add button on the Send File With Request section. Fill the textbox under “Send File With Request” with the following data-

  • File Path : Path of the file to be uploaded (local directory)
  • Parameter Name : The parameter name is the value of the “name” attribute of the file type tag(upload button) e.g. in case of file upload in tinypic.com, the value of “Parameter Name” will be “the_file”. Refer to image below for reference – just inspect element(F12) on the upload button and fetch the value of name attribute.
  • Mime Type : This determines the type of file to be uploaded e.g. for text file the value of Mime Type will be “text/plain”, for image “image/jpeg” etc.File Upload in jmeter

This concludes the file upload handling in the JMeter tutorial. please comment below if you have any queries. Check out the complete JMeter tutorial below.

JMeter Tutorial

1 thought on “File Upload in JMeter”

Leave a Comment