title: How can I handle the error "expected str, bytes or os.PathLike object, not InMemoryUploadedFile' in Python or Django?
body: <p>Before explaining my problem in detail, here are my codes.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class SimilarStore(models.Model):
      store = models.ForeignKey(Store)
  
      domain = models.CharField(max_length=100, blank=True)
      score = models.IntegerField(blank=True)
      rank = models.IntegerField(blank=True)
  
      created_on = models.DateTimeField(auto_now_add=True)
      updated_on = models.DateTimeField(auto_now=True)
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class SimilarStoreForm(forms.ModelForm):
      similarstore_csv = forms.FileField()
  
      class Meta:
          model = SimilarStore
          fields = ('store', 'similarstore_csv')
  
      def save(self, commit=False, *args, **kwargs):
          form_input = SimilarStoreForm()
  
          self.store = self.cleaned_data['store']
          csv_file = self.cleaned_data['similarstore_csv']
  
          for line in csv_file:
              self.domain = line[0]
              self.score = line[1]
              self.rank = line[2]
              form_input.save()
  </code></pre>
  
  <p><strong>data.csv</strong></p>
  
  <pre><code>roolee.com,100,125225
  piperandscoot.com,29.3,222166
  calledtosurf.com,23.8,361542
  cladandcloth.com,17.9,208670
  neeseesdresses.com,9.6,251016
  ...
  </code></pre>
  
  <p>I'm trying to upload <code>data.csv</code> to DB. I need each column data in the file to go into <code>domain</code>, <code>score</code>, <code>rank</code> in <code>SimilarStore</code> model. This is what I'm trying to do with the above codes.</p>
  
  <p>However, when I upload the file and submit it, an error shows up, saying </p>
  
  <p><code>expected str, bytes or os.PathLike object, not InMemoryUploadedFile
  </code></p>
  
  <p>I've done some research about it, but nothing worked for my case. Can anyone figure out anything wrong?</p>