[Gatling 2] Fileuploads

Hi guys,

I’m struggeling a bit with a simple multipart fileupload. I’ve tried to add a .rawBodyPart() on the post request, but it seems like this is not the thing I am looking for.

To clarify, I want to post to an URL, and attach a file from disk to a param (“fileUpload”).

This was done via the .upload-method in gatling 1.5, but I cannot seem to find the corresponding way to do it in gatling 2.



We’re completely refactoring multipart support v2 and will have something stable for 2.0.0-M3.
What you have to use is rawFileBodyPart
There’s a unofficial timestamped version in Excilys’ Nexus named that you can try:





So basically we’ll have to construct the request “by hand”?

What do you mean, by hand?

Not very well formulated by me I’m afraid. I’ll try to explain with an example:

When uploading a file through a browser, the headers look something like this:

Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryIEYgyLofyZbvhndP

And the file-part look like this:


Content-Disposition: form-data; name=“fileInput”; filename=“pdf-file.pdf”

Content-Type: application/pdf

When I try with .rawFileBodyPart(“fileInput”, “pdf-file.pdf”, “application/pdf”, “upload”) the headers look good, but the file part looks like this:


Content-Type: application/pdf; charset=utf-8

Content-Transfer-Encoding: binary

Content-ID: upload

kl. 11:43:36 UTC+2 fredag 21. juni 2013 skrev Stéphane Landelle følgende:


  • Content-Disposition is not generated, I’ll have to check why

  • Regarding Content-ID, just dont pass one and you won’t get one

  • Regarding Content-Type, there’s a charset=utf-8 that shouldn’t probably be there
    Does this cause your upload not to work?

It is the missing "name=“fileInput”; " that causes the upload to fail, but that is probably a part of the content disposition issue?
The back-end should be fairly agnostic to content type and charset (at least in this part of the chain).

kl. 12:42:09 UTC+2 fredag 21. juni 2013 skrev Stéphane Landelle følgende:


Just one last question: which version do you use? 2.0.0-M2 or

Using the timestamped one.

I’ve refactored Body and BodyParts APIs so that one gets full control over parts properties: https://github.com/excilys/gatling/issues/1238
I’ll produce a new timestamp ASAP, and we’ll probably release 2.0.0-M3 within a week from now, once we’ll have properly tested it.



Again, thanks a million Stéphane!

I’m going to test this asap!


kl. 12:32:20 UTC+2 mandag 24. juni 2013 skrev Stéphane Landelle følgende: