How to create a file upload request in JMeter

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:

  1. 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.

  2. Open the test plan in the JMeter GUI and select the Thread Group that should send the upload.
  3. Add an HTTP Request sampler under the Thread Group from Thread GroupAddSamplerHTTP Request.
  4. Name the sampler for the upload action.
  5. 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

  6. Select Use multipart/form-data for HTTP POST.
  7. 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.

  8. 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.

  9. Add any non-file form fields under Parameters when the endpoint requires metadata.
    Name: description
    Value: smoke-test-upload
  10. Save the test plan.
  11. 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
  12. 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
  13. 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.