mitulagr2 commited on
Commit
2cfa0e6
1 Parent(s): d7e310c

fix upload

Browse files
Files changed (1) hide show
  1. app/main.py +2 -4
app/main.py CHANGED
@@ -42,10 +42,8 @@ def upload(files: list[UploadFile]):
42
  for file in files:
43
  path = f"files/{file.filename}"
44
  try:
45
- suffix = Path(file.filename).suffix
46
- with NamedTemporaryFile(delete=False, suffix=suffix) as tmp:
47
- shutil.copyfileobj(file.file, tmp)
48
-
49
  finally:
50
  file.file.close()
51
  finally:
 
42
  for file in files:
43
  path = f"files/{file.filename}"
44
  try:
45
+ with Path(path).open("wb") as destination:
46
+ shutil.copyfileobj(file.file, destination)
 
 
47
  finally:
48
  file.file.close()
49
  finally: