Check if a file with same name already exist's
This commit is contained in:
parent
16761d4382
commit
8113202f5f
1 changed files with 4 additions and 0 deletions
4
main.go
4
main.go
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue