title: Python Django- How do I read a file from an input file tag?
body: <p>I don't want the file to be saved on my server, I just want the file to be read and printed out in the next page. Right now I have this.</p>
  
  <pre><code>(index.html)
      &lt;form name="fileUpload" method="post"&gt;
          &lt;input type="file" /&gt;
          &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>And I'm trying to do something like this-</p>
  
  <pre><code>def upload_file(request):
      if request.method == "POST":
          upload = request.POST.get('fileUpload').read()
          return render(request, 'directory/return.html', {'output': upload})
      else:
          return render(request, 'directory/index.html')
  </code></pre>
  
  <p>But obviously that just doesn't work. I want it to work for text files and csv files.</p>
  
  <p>Thank you.</p>