Collection runner with file uploads


I know that this is currently unavailiable.

But i don’t find it in feature requests, so… this is it. )


Set Body-File via Pre-Request-Script?

Is it still not possible to upload a file from a Request inside a Collection when using Runner? I have Postman 6.7.3 at the moment. The Requests in my Collection are sequential, and I can’t run just the one that does a file upload from the Request Builder. So, to finish writing my test suite, I need the ability to run all the requests. Using the Runner is convenient. Exporting the Collection, modifying all the request.body.formdata[x].srcproperties, and then running it in the shell with Newman is less convenient.

I wouldn’t mind using a Pre-request Script to manipulate the Request before the Runner executes it. However, I see on a GitHub Issue that the pm.request.body is read-only. At least it was back then. It’s hard to know what the current status is.



Since old school file uploads are so problematic (for so many reasons), I’ve decided to modify my API so the client can upload a file as a traditional multipart/form-data POST, or alternatively the encoded file content can be part of a raw request body. This side-steps the trouble of pairing some literal file on the filesystem with the test being executed. It’s a little tricky to support both mechanisms. This workaround becomes impractical for Postman Requests with files larger than ~1Mb, mostly due to delay in syncing the Postman data. Any public API supporting this mechanism will want to have an upstream request body size limiter in place.

Another possible workaround would be to have the client send a reference to the file, rather than the file itself – perhaps a path to a AWS S3 object or a file in Dropbox. I didn’t want to consider the security issues and performance problems with this approach though.



+1 on this request. We are currently using Postman to test a file upload tool, and we have automated tests that run through Newman. Every time I change our collection I download the json file and then manually change it to include the file location for upload. This is cumbersome and time-consuming. It would be great to have a way to save the file needed in Postman itself so it would export whenever we export the collection.



There is always the option of creating python script that added the files needed to the suit of tests automagically and then runs the newman script. It shouldn’t be too hard to write if you know python at all.



I have file uploads working in the workspace, however when I run it in the Collection Runner and Monitor, it fails. The workaround seems to be to use Newman, but as pointed out in this thread, this is not convenient. Can Postman support please confirm when this will be fixed?