Allow overwrite

This commit is contained in:
Dita Aji Pratama 2026-04-19 23:21:01 +07:00
parent cd92b32d57
commit 5145f80934

View File

@ -5,7 +5,7 @@ def upload(file, directory, new_name=None):
if not new_name:
new_name = file.filename
full_path = os.path.join(directory, new_name)
file.save(full_path)
file.save(full_path, overwrite=True)
return {"status": "success", "path": full_path}
except Exception as e:
return {"status": "failed", "error": str(e)}