From 7ea46d4eeb69f4af13c3f8eecfb350bebccafa83 Mon Sep 17 00:00:00 2001 From: Nodauf Date: Mon, 21 Feb 2022 15:10:06 +0400 Subject: [PATCH] Add log and fix a bug when checking an uploaded file --- src/controllers/upload.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/upload.go b/src/controllers/upload.go index e060a38..b30e6ed 100644 --- a/src/controllers/upload.go +++ b/src/controllers/upload.go @@ -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