Upload, Download, and Visualize Files in Postman

Hi Everyone!

For those of you who’ve wanted to work with files in Postman, including uploading, downloading and visualizing files, I’ve made a video on just that, with a Postman Template!

Visualizing files gets a little complicated in Postman, but you can make the HTML in Postman and visualize the file in a web browser. Otherwise, we can make an enhancement request for the development team at Postman.

Here is the template:

Hope you all enjoy :slight_smile:

Best,
Orest

4 Likes

Hi do you have a nother video that show how to upload multiple files instead of uploading 1 file?

Thanks,

1 Like

Hi @RSAL,

Welcome to the community :clap:

So in the first part of the video where I talk about uploading, you can select multiple files by using the shift key, as you normally would in Finder or File Explorer, which should then upload the selected files.

Let me know if this makes sense!

Best,
Orest

1 Like

Hi thanks for you reply , when I select 2 files it returns 1 base64 response? so for example if I want to send a front and a back of an image and select both of them will it return a base 64 for both of them?

Thanks

Hi @RSAL,

When using Postman Echo, and sending it 2 files, with multipart, it actually returns 2 base64 encoded files. They will reside under the files attribute in the response object, and look like so:

files: { file1: "...base64...", file2: ...base64..."

I just tested this out and its how it looked for me.

So in your case, you will get both front and back image base64 encoded responses, separately.

Let me know if this makes sense!

Best,
Orest

Hi,

When you say files: { file1: “…base64…”, file2: …base64…" is that the response body? What I need to add in the postman headers and in the body form data?

Hi @RSAL,

Yup thats the response body. What you have shown me so far looks right in the request. Here is an example of the response, when I uploaded 2 files, package-lock.json and package.json:

Hope this makes sense!

Best,
Orest

Thanks for your reply,

You have uploaded 2 files type json but what if I uploaded 2 files type jpg? as I am currently getting 400 bad request

You’re welcome.

Interesting, as I just tried this and I didnt receive any errors, I got a 200 back with the base64 images back.

Can you maybe change your “key” to “file” instead of “files”? This shouldnt have anything to do with it, but thats just a random guess. The key I am using is “file”.

Only other thing I can thing of is if your JPGs are malformed and creating some kinda bad base64 encoded version of the images, though I have nothing to back up that statement either.

I’m not really sure whats going on as the error response is very generic, but those two guesses above are the best things I can come up with right now.

Best,
Orest