Пример #1
0
    def __save_file(self, file):
        path = "%s/%s" % (app.config["UPLOAD_FOLDER"], datetime.now().strftime("%Y-%m-%d"))
        path = path.replace("/", os.sep)
        if not os.path.exists(app.root_path + path):
            os.makedirs(app.root_path + path)

        uid = "%s" % uuid.uuid1()

        Upload.add(file.filename, uid)

        file_path = os.path.join(path, uid)
        file.save(app.root_path + file_path)
        return file_path