title: How to add files in Django session?
body: <p>I want to get some files from the user and after getting the files, I want the user should make a payment after payment is done, an order should be created and the files should be stored against that order in the Database. I know how to create an order and store the files in a database.</p>
  <p>I have used Django's sessions to store the string data. But want to store files also. I have used the following code :</p>
  <p>In HTML:</p>
  <pre><code>&lt;form method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;
  
         &lt;input type=&quot;file&quot; name=&quot;filename&quot;&gt;
  
  &lt;/form&gt;
  </code></pre>
  <p>In views.py :</p>
  <pre><code>if request.method == &quot;POST&quot;:
      request.session['filename'] = request.FILES['filename']
  </code></pre>
  <p>It throws errors as :
  <strong>Object of type InMemoryUploadedFile is not JSON serializable</strong></p>