def save_to_mongo(request): result = 0 upload_file = request.FILES['avatar_file'] if AccountService.validate_upload_file(upload_file): result = MongoDBService.save_file(upload_file, UCenterMongoFile) return result
def save_to_mongo(request): result = 0 upload_file = request.FILES['service_file'] if CIService.validate_upload_file(upload_file): result = MongoDBService.save_file(upload_file, CIServiceMongoFile) return result
def save_to_mongo(file, mongo_model): result = ["0", "文件大小不能超过10M"] if BusinessService.validate_upload_file(file, 10 * 1024 * 1024, None): mongo_id = MongoDBService.save_file(file, mongo_model) result[0] = mongo_id return result
def save_to_mongo(file, size, mongo_model): result = 0 upload_file = file if UploadFileService.validate_upload_file(upload_file, size, None): result = MongoDBService.save_file(upload_file, mongo_model) return result