|
@@ -56,8 +56,7 @@ async def upload_file(files: list[UploadFile] = File(...)):
|
|
|
if file.filename == '':
|
|
if file.filename == '':
|
|
|
return JSONResponse(content={"error": "没有选择文件"}, status_code=400)
|
|
return JSONResponse(content={"error": "没有选择文件"}, status_code=400)
|
|
|
if file and allowed_file(file.filename):
|
|
if file and allowed_file(file.filename):
|
|
|
- filename = secure_filename(file.filename)
|
|
|
|
|
- save_path = os.path.join(SOURCE_FILES_PATH, filename)
|
|
|
|
|
|
|
+ save_path = os.path.join(SOURCE_FILES_PATH, file.filename)
|
|
|
with open(save_path, 'wb') as buffer:
|
|
with open(save_path, 'wb') as buffer:
|
|
|
shutil.copyfileobj(file.file, buffer)
|
|
shutil.copyfileobj(file.file, buffer)
|
|
|
save_path_list.append(save_path)
|
|
save_path_list.append(save_path)
|