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:
https://explore.postman.com/templates/14323/file-processing

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

Hello, I’m testing your visualizer collection. I am getting an error related to your variable {{url}}. What exactly is suppose to be populated in {{url}}? Thank you.

Hi @smiller1245,

Welcome to the community! :tada:

Assuming you are using the Environment with that collection, it looks like my Mock Server has been deleted. Thankfully the example should still be there.

So what you can do is create your own Mock Server off of that collection, and then change the {{url}} variable, to the new mock url endpoint you generate, and the requests should work once more. I have a video on how to make a Mock Server if you want to refer to that. It’s a little outdated given the new use interface, however the same concepts should apply. You’ll just need to click on the Mock Server icon to and select the File Processing collection, and that should do it for you.

Best,
Orest

I have created this simple guide to upload file using postman

But I am curious and wanted to know, if we can upload file directly to Azure blob storage directly using postman?