From 3ebe2ab7650a07b5e280a0af2dc8a9ee4a64439a Mon Sep 17 00:00:00 2001 From: raul Date: Fri, 3 May 2024 09:18:23 +0200 Subject: [PATCH] Check for errors during file copy --- cmd/serverFunc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/serverFunc.go b/cmd/serverFunc.go index e33babf..8b5625f 100644 --- a/cmd/serverFunc.go +++ b/cmd/serverFunc.go @@ -39,7 +39,10 @@ func uploadFile(w http.ResponseWriter, r *http.Request) { log.Printf("Error happened opening file: %v\n", err) } - io.Copy(f, file) + _, err = io.Copy(f, file) + if err != nil { + log.Printf("Error happened writing file: %v\n", err) + } } func server() {