Roméo Després
Roméo Després

Reputation: 2163

How to upload a file from a URL as multipart/form-data in Postman

I have an API endpoint that accepts multipart/form-data file upload. I managed to upload a local file to it with Postman using the File option as below:

Postman request body screenshot

Now how can I upload a file that is hosted at a given URL using Postman without manually downloading it and then selecting its filename as in the above screenshot? I'm hoping to somehow GET the URL, store the binary data, and upload to the endpoint, all within a Postman collection.

Upvotes: 3

Views: 1384

Answers (1)

Yehor Orlov
Yehor Orlov

Reputation: 81

One of the answers from Postman community issue:

Using Postman’s pre-request script:

  1. Download the content from URL
  2. Convert it to binary
  3. Assign the binary value to a dynamic variable
  4. Use the variable within your request

Upvotes: 1

Related Questions