How can I upload files in Postman?


I want to pass images through POST method in POSTMAN but I get None type response in the line request.files[‘image’]

I have tried a number of different things but I am not able to solve the problem.

from flask import Flask,jsonify
from flask import request
import face_recognition
import json

app = Flask(__name__)

def index():
   return ''

@app.route('/valid_faces', methods=['POST'])

def POST():
    if request.method == 'POST':

    # getting the images url from the request
    name1 = request.files['file'] if request.files.get('file') else None
    print (name1)        # name2 = request.form.get('name2')

    # map the url to the ones in the folder images
    firstImage = name1

    # loading the image inside a variable
    firstImage = face_recognition.load_image_file(firstImage)


    if result:
        # x={'valid_faces':True}
        # return jsonify(x)
        return "True"
        # x={'valid_faces':False}
        # return jsonify(x)
        return "False"

if __name__ == "__main__":
Asked By: Bivek Gyawali



If you wish to append a file to a postman call it needs to be added to the body.
Check form-data and select file instead of text. You can now select a file with the windows file explorer.

To obtain the given file use the request package.

file = request.files['file']

The index has to be the same string you specified within the postman body data.

Answered By: ZKDev

In my case Postman set empty first value for FileStorage object in request.files . You can check this using:


And in case of empty index instead

file = request.files['file']

try to use

file = request.files['']
Answered By: Bhramari

In Postman, do the following:

  • Set the method to POST
  • Set the body type to form-data
  • Establish Key/Value pairs for input. Set the value for the Key to
  • Mouse over the Key field and choose Text or File from the drop-down
  • Click Send to process the request
Answered By: Arkadit Vinokurov

follow this process:

  • Set Method to POST
  • Change body tab to form-data
  • Set key
  • in Value, hover, you can see file/text. in here select file
  • Select file you want to upload.
  • Send request.
Answered By: cedric

you can do it

 files = request.files.getlist("file")
Answered By: Khanbala Rashidov
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.