# How to upload file using file path instead of RawFileBody?

**URL:** <https://community.gatling.io/t/how-to-upload-file-using-file-path-instead-of-rawfilebody/922>\
**Category:** Gatling (Open-Source)\
**Created:** [April 3, 2014, 7:50am UTC](https://community.gatling.io/t/how-to-upload-file-using-file-path-instead-of-rawfilebody/922 "2014-04-03T07:50:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ictest0214](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@ictest0214](https://community.gatling.io/u/ictest0214)\
**Post date:** [April 3, 2014, 7:50am UTC](https://community.gatling.io/t/how-to-upload-file-using-file-path-instead-of-rawfilebody/922/1 "2014-04-03T07:50:36Z")

</div>

Hi,

I’m using gatling-charts-highcharts-2.0.0-SNAPSHOT archetype for IntelliJ. My page have some textboxes and upload file control, when running Recorder to record upload file, i have:  
.exec(http(“request\_15”)  
.post("""/pages/upload.aspx""")  
.headers(headers\_15)  
.body(RawFileBody(“upload\_request\_15.txt”)))

“upload\_request\_15.txt” contains:

-----------------------------207612174825532  
Content-Disposition: form-data; name=“configuration”

{“ContainerUid”:“dd06748f-0980-47cd-b8fe-85c5c2a1feeb”,“DocumentTypeAccessLevel”:“Program”,“UserEnteredFileName”:“Test Koala 5”,“DocumentTypeUid”:“8ffd0388-0ea9-44f1-a42f-c610e9b45553”,“ProgramUid”:“cd5def0e-2b24-4ebe-bf5c-b8cf811340ff”,“SafetyEventDate”:“04/30/2014”,“McnNumber”:“44”,“Dose”:“555”,“TrialOfOrigin”:“66”}  
-----------------------------207612174825532  
Content-Disposition: form-data; name=“files[]”; filename=“Koala.jpg”  
Content-Type: image/jpeg

…format file content here.

-----------------------------207612174825532–

How can i change scenario to achieve above by using file path instead of “upload\_request\_15.txt” format above (note: there is JSON value in the file)?

Thanks.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [April 3, 2014, 8:12am UTC](https://community.gatling.io/t/how-to-upload-file-using-file-path-instead-of-rawfilebody/922/2 "2014-04-03T08:12:21Z")

</div>

You have to use BodyParts instead: [https://github.com/excilys/gatling/blob/master/src/sphinx/http/http\_request.rst#request-body](https://github.com/excilys/gatling/blob/master/src/sphinx/http/http_request.rst#request-body)
