コード例 #1
0
    def create_directory(self, name):
        name = STORAGE.get_valid_name(name)
        tmpfile = os.path.join(name, '.tmp')

        path = os.path.join(self.path, tmpfile)
        STORAGE.save(path, ContentFile(''))
        STORAGE.delete(path)
コード例 #2
0
ファイル: core.py プロジェクト: mythic2000/django-filemanager
 def upload_file(self, filedata):
     filename = STORAGE.get_valid_name(filedata.name)
     filepath = os.path.join(self.path, filename)
     signals.filemanager_pre_upload.send(sender=self.__class__, filename=filename, path=self.path, filepath=filepath)
     STORAGE.save(filepath, filedata)
     signals.filemanager_post_upload.send(sender=self.__class__, filename=filename, path=self.path, filepath=filepath)
     return filename
コード例 #3
0
 def upload_file(self, filedata):
     filename = STORAGE.get_valid_name(filedata.name)
     filename, ext = os.path.splitext(filename)
     filename = slugify(re.sub("\d+", "", filename)) + ext
     filepath = os.path.join(self.path, filename)
     signals.filemanager_pre_upload.send(sender=self.__class__,
                                         filename=filename,
                                         path=self.path,
                                         filepath=filepath)
     STORAGE.save(filepath, filedata)
     signals.filemanager_post_upload.send(sender=self.__class__,
                                          filename=filename,
                                          path=self.path,
                                          filepath=filepath)
     return filename