Check if a file with same name already exist's
This commit is contained in:
parent
16761d4382
commit
8113202f5f
4
main.go
4
main.go
@ -67,6 +67,10 @@ func Upload(c echo.Context) error {
|
|||||||
return err
|
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()
|
src, err := file.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user