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 b946ff7288
commit ce81859b0c

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