title: How to access request.FILES in my views?
body: <p>Trying to upload an image to a model <code>image</code> field with AJAX. Here's my code:</p>
  
  <p>js</p>
  
  <pre><code>$('input#id_banner_image').on('change', function(e) {
  
      $.ajax({
          type: 'POST',
          url: '/change_banner_image/',
          data: {
              image: URL.createObjectURL(e.target.files[0]),
              csrfmiddlewaretoken: $("input[name='csrfmiddlewaretoken']").val()
          }
  
      })
  });
  </code></pre>
  
  <p>views</p>
  
  <pre><code>def change_banner_image(request):
      if request.is_ajax():
          print(request.FILES) #prints &lt;MultiValueDict: {}&gt;
          for i in request.FILES:
              print(i) #prints nothing
          image = request.FILES['id_banner_image'].name #this is wrong
          profile = get_object_or_404(Profile, user=request.user)
          profile.image = image
          profile.save()
  
      return HttpResponse()
  </code></pre>
  
  <p>How do I correctly grab the image in my <code>views</code>? I know that's the bit that's wrong.</p>