1
0
forked from crony/UpFast

Check if a file with same name already exist's

This commit is contained in:
CronyAkatsuki 2023-12-19 21:49:49 +01:00
parent 16761d4382
commit 8113202f5f

View File

@ -67,6 +67,10 @@ func Upload(c echo.Context) error {
return err
}
if _, err := os.Stat("files/" + file.Filename); err == nil {
return c.String(http.StatusOK, "A file with the same name already exist's on the server.\n")
}
src, err := file.Open()
if err != nil {
return err