old_contents: from io import FileIO, BufferedWriter
  import os
  
  from django.conf import settings
  
  from ajaxuploader.backends.base import AbstractUploadBackend
  
  class LocalUploadBackend(AbstractUploadBackend):
      UPLOAD_DIR = "uploads"
  
      def setup(self, filename):
          self._path = os.path.join(
              settings.MEDIA_ROOT, self.UPLOAD_DIR, filename)
          try:
              os.makedirs(os.path.realpath(os.path.dirname(self._path)))
          except:
              pass
          self._dest = BufferedWriter(FileIO(self._path, "w"))
  
      def upload_chunk(self, chunk):
          self._dest.write(chunk)
  
      def upload_complete(self, request, filename):
          path = settings.MEDIA_URL + self.UPLOAD_DIR + "/" + filename
          self._dest.close()
          return {"path": path}
  
new_contents: import os
  from io import FileIO, BufferedWriter
  
  
  from django.core.files.storage import default_storage
  from django.core.files.base import ContentFile
  from django.template.loader import render_to_string
  
  from ajaxuploader.backends.base import AbstractUploadBackend
  
  
  class LocalUploadBackend(AbstractUploadBackend):
      UPLOAD_DIR = 'uploads'
  
      def setup(self, filename):
          # join UPLOAD_DIR with filename 
          new_path = os.path.join(self.UPLOAD_DIR, filename)
  
          # save empty file in default storage with path = new_path
          self._path = default_storage.save(new_path, ContentFile(''))
  
          # get absolute path to new file
          self._abs_path = default_storage.path(self._path)
  
          # create BufferedWriter for new file
          self._dest = BufferedWriter(FileIO(self._abs_path, "w"))
  
      def upload_chunk(self, chunk):
          self._dest.write(chunk)
  
      def upload_complete(self, request, filename):
          self._dest.close()
          return {"path": self._path}
  
subject: use default_storage to save local files