title: Uploading images to a Flask server using FilePond (React component)
body: <p>I have a locally hosted Flask server and a small React application. I'm trying to use <a href="https://pqina.nl/filepond/" rel="nofollow noreferrer">FilePond</a> as an easy solution for image uploading. FilePond takes care of sending each image to the server.</p>
  
  <p>So the problem I'm obviously having is with the backend code. I've set up my server like this, <a href="http://flask.pocoo.org/docs/1.0/patterns/fileuploads/" rel="nofollow noreferrer">per Flask's docs</a></p>
  
  <pre><code>UPLOAD_FOLDER='/images'
  ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
  
  app = Flask(__name__)
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
  
  
  def allowed_file(filename):
      return '.' in filename and \
          filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
  
  @app.route('/', methods=['GET', 'POST'])
  def upload_file():
  print(request.files)
      if request.method == "POST":
          # check if the post request has the file part
          if 'file' not in request.files:
              print('No file part')
              return make_response("No File Part", 400)
          file = request.files["file"]
          # if user does not select file, browser also submit an empty part
          # without filename
          if file.filename == '':
              print('No selected file')
              return make_response("No Selected File", 400)
          if file and allowed_file(file.filename):
              filename = secure_filename(file.filename) # filenames can be dangerous!
              file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
              return make_response("Success", 201)
  </code></pre>
  
  <p>However, when put a </p>
  
  <pre><code> print(request.files)
  </code></pre>
  
  <p>statement at the beginning of the upload_file() function, it seems that this is the request the server is receiving:</p>
  
  <pre><code>ImmutableMultiDict([('images', &lt;FileStorage: 'imageName.jpg' ('image/jpeg')&gt;)])
  </code></pre>
  
  <p>and I have no idea how to deal with that. I don't know if 'images' is where 'file' is supposed to be. I'm just not really sure where to go from here or what to do with the data being received. I don't know what  is, I've never seen that &lt;> syntax being used.</p>
  
  <p>Can anyone help?</p>
  
  <p>Here's a <a href="https://pastebin.com/6MQtac2u" rel="nofollow noreferrer">pastebin for the whole server-side code</a></p>
  
  <p>Thank you!</p>