title: FLASK uploads broken image
body: <p>I am trying to upload pictures and display it in a URL.</p>
  <p>my server:</p>
  <pre><code>app = Flask(__name__)
  APP_ROOT = os.path.dirname(os.path.abspath(__file__))
  UPLOAD_FOLDER = os.path.join(APP_ROOT, 'static/uploads')
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
  
  @app.route('/post_pic',methods=['POST','GET'])
  def post_picture():
      if request.method == 'POST':
          file1 = request.files['image']
          path1 = os.path.join(app.config['UPLOAD_FOLDER'], file1.filename)
          file1.save(path1)
          return_status = {&quot;success&quot;:&quot;true&quot;}
          return jsonify(return_status)
  
      list_of_files = glob.glob(UPLOAD_FOLDER + '/*') # get latest file
      latest_file = max(list_of_files, key=os.path.getctime)    
      return render_template(&quot;show_pic3.html&quot;, file1=latest_file)
  </code></pre>
  <p><code>show_pic3.hrml</code> code:</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;show_pic&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;img src=&quot;{{url_for('static', filename=file1)}}&quot; align= &quot;middle&quot; /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I then use POST request to upload picture which doesn't show any problems. but after I use GET on the same endpoint, the image became broken.</p>
  <p><a href="https://i.stack.imgur.com/7BYtR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7BYtR.png" alt="enter image description here" /></a></p>