wsj1995 commited on
Commit
ce4fa2b
·
verified ·
1 Parent(s): b719f25

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -0
main.py CHANGED
@@ -25,11 +25,13 @@ def read_root():
25
 
26
  @app.post("/upload")
27
  async def upload_file(file: UploadFile = File(...)):
 
28
  # 定义文件存储路径和名称
29
  file_location = os.path.join(UPLOAD_DIRECTORY, file.filename)
30
 
31
  # 将上传的文件写入本地文件系统
32
  with open(file_location, "wb") as buffer:
 
33
  buffer.write(await file.read())
34
 
35
  return {"info": f"file '{file.filename}' saved at '{file_location}'"}
 
25
 
26
  @app.post("/upload")
27
  async def upload_file(file: UploadFile = File(...)):
28
+ print(f'收到请求 {file.filename}')
29
  # 定义文件存储路径和名称
30
  file_location = os.path.join(UPLOAD_DIRECTORY, file.filename)
31
 
32
  # 将上传的文件写入本地文件系统
33
  with open(file_location, "wb") as buffer:
34
+ print(f'写入本地文件 {file.filename}')
35
  buffer.write(await file.read())
36
 
37
  return {"info": f"file '{file.filename}' saved at '{file_location}'"}