aminaj commited on
Commit
b481937
·
verified ·
1 Parent(s): 1c45b40

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -2
main.py CHANGED
@@ -113,8 +113,11 @@ async def upload_file_on_server(file: UploadFile = File(...)):
113
  file_path = os.path.join(data_dir, file.filename)
114
 
115
  # Save the uploaded file to a temporary location
116
- with open(file_path, "wb") as buffer:
117
- shutil.copyfileobj(file.file, buffer)
 
 
 
118
 
119
  # Return a response
120
  return {"filename": file.filename, "message": "File uploaded successfully"}
 
113
  file_path = os.path.join(data_dir, file.filename)
114
 
115
  # Save the uploaded file to a temporary location
116
+ # with open(file_path, "wb") as buffer:
117
+ # shutil.copyfileobj(file.file, buffer)
118
+
119
+ with open(file_path, "wb") as f:
120
+ f.write(file.file.read())
121
 
122
  # Return a response
123
  return {"filename": file.filename, "message": "File uploaded successfully"}