iShare commited on
Commit
93c60e9
1 Parent(s): cb502f0

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -0
main.py CHANGED
@@ -36,6 +36,9 @@ async def home():
36
  async def upload_file(username: str, file_to_process: FileToProcess = Depends()):
37
  uploaded_file = file_to_process.uploaded_file
38
  print("File received:"+uploaded_file.filename)
 
 
 
39
  #print("File received:"+file_to_process.filename)
40
  #`file_to_process`是`FileToProcess`类的一个实例,它具有一个名为`uploaded_file`的属性,而不是`filename`属性。
41
  #因此,在打印`"File received:"+file_to_process.filename`时会引发`AttributeError`。
@@ -45,6 +48,7 @@ async def upload_file(username: str, file_to_process: FileToProcess = Depends())
45
  file_path.mkdir(parents=True, exist_ok=True)
46
  file_saved_in_api = file_path / uploaded_file.filename
47
  print(file_saved_in_api)
 
48
 
49
  with open(file_saved_in_api, "wb+") as file_object:
50
  file_object.write(uploaded_file.file.read())
@@ -74,6 +78,7 @@ async def upload_file(username: str, file_to_process: FileToProcess = Depends())
74
  print(api_call_msg["INFO"])
75
  #File 'uploaded_file' saved to your profile.
76
  print()
 
77
 
78
  print("API call finished...")
79
 
 
36
  async def upload_file(username: str, file_to_process: FileToProcess = Depends()):
37
  uploaded_file = file_to_process.uploaded_file
38
  print("File received:"+uploaded_file.filename)
39
+ print("File received:", uploaded_file.filename)
40
+ print("File received: " + str(uploaded_file.filename))
41
+
42
  #print("File received:"+file_to_process.filename)
43
  #`file_to_process`是`FileToProcess`类的一个实例,它具有一个名为`uploaded_file`的属性,而不是`filename`属性。
44
  #因此,在打印`"File received:"+file_to_process.filename`时会引发`AttributeError`。
 
48
  file_path.mkdir(parents=True, exist_ok=True)
49
  file_saved_in_api = file_path / uploaded_file.filename
50
  print(file_saved_in_api)
51
+ print(file_saved_in_api.resolve())
52
 
53
  with open(file_saved_in_api, "wb+") as file_object:
54
  file_object.write(uploaded_file.file.read())
 
78
  print(api_call_msg["INFO"])
79
  #File 'uploaded_file' saved to your profile.
80
  print()
81
+ print(api_call_msg["INFO"].replace("uploaded_file", uploaded_file.filename))
82
 
83
  print("API call finished...")
84