File upload tests need JMeter to send the same multipart form field that the application receives from a browser or API client. An HTTP Request sampler can attach a local file to a POST request while preserving the file field name, uploaded file name, and MIME type expected by the upload endpoint.
The file row belongs in the sampler's Files Upload area, while ordinary form fields stay under Parameters. Filling File Path makes JMeter send the request as multipart form data, and Parameter Name must match the server-side file field such as uploadFile rather than a local variable name.
Keep the first run small before raising thread count, file size, or test duration. Place fixture files where every JMeter engine can read them, use neutral sample files in shared .jmx plans, and verify the server receives the upload before using the sampler for size limits, virus-scan paths, or storage workflows.
Steps to create a JMeter file upload request:
- Save a small fixture file next to the .jmx test plan.
quarterly upload smoke test
Relative file paths resolve from the saved test plan location during a CLI run. In distributed mode, place the same file at the same relative path on every JMeter server.
- Open the test plan in the JMeter GUI and select the Thread Group that should send the upload.
- Add an HTTP Request sampler under the Thread Group from Thread Group → Add → Sampler → HTTP Request.
- Name the sampler for the upload action.
- Set the upload endpoint and request method.
Protocol: https Server Name or IP: upload.example.net Port Number: 443 Method: POST Path: /upload
Use HTTP Request Defaults for shared protocol, host, and port values when several samplers hit the same application.
Related: How to configure HTTP Request Defaults in JMeter - Select Use multipart/form-data for HTTP POST.
- Leave Browser-compatible headers disabled when the endpoint expects the MIME type from the file row.
When Browser-compatible headers is enabled, JMeter omits the multipart part's Content-Type and Content-Transfer-Encoding headers and sends only Content-Disposition for the part.
- Add one row under Files Upload.
File Path: upload-sample.txt Parameter Name: uploadFile MIME Type: text/plain
Do not leave Parameter Name empty for a browser-style file field. A single file with no parameter name can be sent as the whole request body instead of as a named multipart part.
- Add any non-file form fields under Parameters when the endpoint requires metadata.
Name: description Value: smoke-test-upload
- Save the test plan.
- Run a one-user smoke test in non-GUI mode.
$ jmeter -n -t file-upload-request-create.jmx -l upload-results.jtl Creating summariser <summary> Created the tree successfully using file-upload-request-create.jmx Starting standalone test @ 2026 Jun 29 22:56:58 GMT Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 summary = 1 in 00:00:00 = 12.5/s Avg: 18 Min: 18 Max: 18 Err: 0 (0.00%) Tidying up ... ... end of run
- Check the .jtl result for a successful upload sampler.
$ cat upload-results.jtl timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect 1782773818789,18,POST /upload file,200,OK,Upload user 1-1,text,true,,129,682,1,1,https://upload.example.net/upload,16,0,14
- Check the upload endpoint log or request inspector for the multipart file fields.
$ cat upload-api.log request method=POST path=/upload field=uploadFile filename=upload-sample.txt mime=text/plain bytes=28 status=200
The field name, file name, MIME type, and success status should match the sampler settings before the plan is reused with larger files or more threads.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.