People have asked how to use the collection runner to run collections which have requests with file uploads. Right now, it’s not possible to upload files in the collection runner. However, you can use Newman, Postman’s command-line companion, as a workaround:
- Create a collection in Postman. Check out a sample collection here:
This collection sends a single
POSTrequest, with two form parameters – one file param, and one text param. The file that was used is https://gist.github.com/abhijitkane/4aba1c3deeb4ed61a623. The request runs successfully in the main Postman window:
- Export the file as JSON (Collection > Export > V2), and save it to your filesystem.
- Open the JSON file for editing. In the
request.body.formdatasection, change the “src” property of the file param to the complete path of the file:
- Run the collection JSON file using Newman:
If you are using Windows, be sure to change the backslashes (\) in the JSON file to double-backslashes so that the JSON remains valid, e.g. if your “value” is “C:\Documents\collection.json”, you’ll need to change it to “C:\\Documents\\collection.json”.
This is an updated post from Using Newman to run collections with file-post requests.