title: Flask, can not get the file part with request.files
body: <p>Here is my HTML:</p>
  <pre><code>{% extends &quot;layout.html&quot; %}
  
  {% block title %}
      Picture
  {% endblock %}
  
  {% block main %}
      &lt;form action=&quot;/picture&quot; method=&quot;post&quot;&gt;
          &lt;div&gt;
              &lt;p&gt;Profile picture (32mb max).&lt;/p&gt;
              &lt;input type=&quot;file&quot; id=&quot;picture&quot; name=&quot;picture&quot; enctype=&quot;multipart/form-data&quot;&gt;
              &lt;input type=&quot;submit&quot; value=&quot;Upload&quot;&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  {% endblock %}
  </code></pre>
  <p>Here is the .py :</p>
  <pre><code>import sqlite3
  import traceback
  import sys
  import os
  
  from flask import Blueprint, render_template, redirect, session, request, flash
  from application import profileName, uploadPicture, profilePicture, allowed_file
  from werkzeug.utils import secure_filename
  
  # Set Blueprints
  picture = Blueprint('picture', __name__,)
  
  @picture.route(&quot;/picture&quot;, methods=[&quot;GET&quot;, &quot;POST&quot;])
  def pictureFunction():
  
      if request.method == &quot;POST&quot;:      
  
          # check if the post request has the file part
          if &quot;picture&quot; not in request.files:
              flash(&quot;No file part&quot;)
              return redirect(&quot;/picture&quot;)
  
          file = request.files[&quot;picture&quot;].read()
  
          # if user does not select file, browser also submit a empty part without filename
          if file.filename == &quot;&quot;:
              flash(&quot;No selected file&quot;)
              return redirect(&quot;/picture&quot;)
  
          # Check if all conditions are satisfied
          if file and allowed_file(file.filename):
              filename = secure_filename(file.filename)
              file.save(os.path.join(&quot;/static&quot;, filename))
          return print(filename)
  
  
  </code></pre>
  <p>When I try to upload a .jpg (allowed file), I always end up in having: &quot;No file part&quot; of the first &quot;if&quot;.</p>
  <p>I don't understand why. Can somebody help me figure out why I can't upload this file?</p>