title: Using Flask to load a txt file through the browser and access its data for processing
body: <p>I am making a data visualization tool that takes input from the user (choosing a file on the computer); processes it in Python with Pandas, Numpy, etc; and displays the data in the browser on a local server.</p>
  
  <p>I am having trouble accessing the data once the file is selected using an HTML input form. </p>
  
  <p>HTML form:</p>
  
  <pre><code>&lt;form action="getfile" method="POST" enctype="multipart/form-data"&gt;
      Project file path: &lt;input type="file" name="myfile"&gt;&lt;br&gt;
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Flask routing:</p>
  
  <pre><code>@app.route("/")
  def index():
      return render_template('index.html')
  
  @app.route('/getfile', methods=['GET','POST'])
  def getfile():
      if request.method == 'POST':
          result = request.form['myfile']
      else:
          result = request.args.get['myfile']
      return result
  </code></pre>
  
  <p>This returns a "Bad Request The browser (or proxy) sent a request that this server could not understand." error. I have tried a number of different ways of getting the data out of the file and simply printing it to the screen to start, and have received a range of errors including "TypeError: 'FileStorage' object is not callable" and "ImmutableMultiDict' object is not callable". Any pointers on how to approach this task correctly are appreciated.</p>