Skip to content

Commit

Permalink
Add log and fix a bug when checking an uploaded file
Browse files Browse the repository at this point in the history
  • Loading branch information
nodauf committed Feb 21, 2022
1 parent ecb3052 commit 7ea46d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controllers/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ func UploadFile(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
f, err := os.Open(filepath)
f, err := os.Open(filepath + "/" + handler.Filename)
defer f.Close()
if err != nil {
http.Error(w, "404 Not Found : Error while opening the file.", 404)
return
}
fmt.Printf("File %s have been saved\n", filepath+"/"+handler.Filename)
}
data := struct {
Directory string
Expand Down

0 comments on commit 7ea46d4

Please sign in to comment.