title: Get input filename and extension without actual uploading witn Flask
body: <p>I use Flask+Python to locate relevant files for further processing. Currently I'm only able to upload files to a specified directory with the following:</p>
  
  <p>Backend:</p>
  
  <pre><code>from flask import Flask, render_template, request
  from werkzeug import secure_filename
  app = Flask(__name__)
  
  @app.route('/upload')
  def upload_file():
     return render_template('upload.html')
  
  @app.route('/uploader', methods = ['GET', 'POST'])
  def upload_file():
     if request.method == 'POST':
        f = request.files['file']
        f.save(secure_filename(f.filename))
        return 'file uploaded successfully'
  
  if __name__ == '__main__':
     app.run(debug = True)
  </code></pre>
  
  <p>Frontend:</p>
  
  <pre><code>&lt;html&gt;
     &lt;body&gt;
  
        &lt;form action = "http://localhost:5000/uploader" method = "POST" 
           enctype = "multipart/form-data"&gt;
           &lt;input type = "file" name = "file" /&gt;
           &lt;input type = "submit"/&gt;
        &lt;/form&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I have several problems and questions with this solution:</p>
  
  <ul>
  <li>I don't want actually touch (move/upload) any file, I only need the
  filenames of the selected files. How to discard the actual uploading
  and get the filenames as a list?</li>
  <li>Is there any way to select a directory (and not specific files) for batch processing?</li>
  </ul>