title: How to upload a pdf file and an image file to different upload folders in flask?
body: <p>I was hoping someone could adjust my code so that it could upload a pdf and image file at once on the same page.
  Below is the html part</p>
  
  <pre><code>&lt;form method="post" enctype="multipart/form-data"&gt;
      Profile Image:
       &lt;br&gt;
      &lt;input type="file" name="img-file" class="bg-warning" style="padding:10px" required&gt;
      &lt;br&gt;&lt;br&gt;
  
      Pdf:
      &lt;br&gt;
      &lt;input type="file" name="pdf-file" class="bg-warning" style="padding:10px" required&gt;
  
      &lt;h6 class="text-success"&gt;{{ msg_name }}&lt;/h6&gt;
      &lt;br&gt;&lt;br&gt;
      &lt;input type="submit" name="submit" value="UPLOAD" class="btn btn-outline-warning"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>next is the flask code. I havent included the upload of 
  pdf file cause the below worked with image files</p>
  
  <pre><code>UPLOAD_FOLDER = 'C:\\Users\\...\\static\\image\\'
  ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
  
  
  def allowed_file(filename):
      return '.' in filename and \
             filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
  
  @app.route('/imageUpload', methods=['GET', 'POST'])
  def upload_file():
      if request.method == 'POST':
          # check if the post request has the file part
          if 'img-file' not in request.files:
              flash('No file part')
              return redirect(request.url)
          file = request.files['img-file']
          # if user does not select file, browser also
          # submit an empty part without filename
          if file.filename == '':
              flash('No selected file')
              return redirect(request.url)
          if file and allowed_file(file.filename):
              filename = secure_filename(file.filename)
              file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
              return redirect(url_for('uploads'))
  
      return render_template('upload-image.html')
  </code></pre>
  
  <p>I tried doubling everything to see if that would work. </p>
  
  <p>didn't work. Any help will be appreciated</p>