Allow overwrite
This commit is contained in:
parent
cd92b32d57
commit
5145f80934
@ -5,7 +5,7 @@ def upload(file, directory, new_name=None):
|
|||||||
if not new_name:
|
if not new_name:
|
||||||
new_name = file.filename
|
new_name = file.filename
|
||||||
full_path = os.path.join(directory, new_name)
|
full_path = os.path.join(directory, new_name)
|
||||||
file.save(full_path)
|
file.save(full_path, overwrite=True)
|
||||||
return {"status": "success", "path": full_path}
|
return {"status": "success", "path": full_path}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {"status": "failed", "error": str(e)}
|
return {"status": "failed", "error": str(e)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user