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.
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.
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?
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:
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?
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:
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.
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.
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.