title: How to process files from request in Flask
body: <p>I am new to flask. I am trying to write a flask web service to parse files(txt files) and get results. Using postman send files to flask.</p>
  <p>How can I read a file  and encoding it (like io.open(file, 'r', encoding = 'utf-16')) from the request and retrieve the content to parse it?</p>
  <p>Here is my code:</p>
  <pre><code>app=Flask(__name__)
  
  @app.route('/process', methods=['GET', 'POST'])
  def post_data():
      if request.method == &quot;POST&quot;:
          files = request.files.getlist(&quot;file&quot;)
          for file in files:
              print(file.data)
              #.....do some processing
              
      return &quot;&quot;
   
   
  if __name__ == '__main__':
      app.run(host= '127.0.0.1', port= 5000)
  </code></pre>