code: def upload_photos(request):
      '''
      takes all the images coming from the redactor editor and
      stores it in the database and returns all the files
      '''
      upurl = ''
      if request.FILES.get("upload"):
          f = request.FILES.get("upload")
          obj = Image_File.objects.create(upload=f, is_image=True)
          obj.save()
          thumbnail_name = 'thumb' + f.name
          if getattr(settings, 'AWS_ENABLED', False):
              image_file = requests.get(obj.upload.url, stream=True)
              with open(thumbnail_name, 'wb') as destination:
                  for chunk in image_file.iter_content():
                      destination.write(chunk)
          else:
              image_file = f
              with open(thumbnail_name, 'wb') as destination:
                  for chunk in image_file.chunks():
                      destination.write(chunk)
          im = Image.open(destination.name)
          size = (128, 128)
          im.thumbnail(size)
          im.save(thumbnail_name)
          with open(thumbnail_name, 'rb') as imdata:
              obj.thumbnail.save(thumbnail_name, File(imdata))
          obj.save()
          os.remove(os.path.join(settings.BASE_DIR, thumbnail_name))
          upurl = "/" + obj.upload.url
      return HttpResponse(
          .format(request.GET['CKEditorFuncNum'], upurl)
      )
docs: takes all the images coming from the redactor editor and
      stores it in the database and returns all the files