r.FormFile("file") if err != nil { http.Error(w, "Unable to read file", 400) return } err = os.MkdirAll("/path/", 0666) if err != nil { http.Error(w, "Unable to create folder", 500) return } resultFile, err := os.Create("/path/" + header.Filename) if err != nil { http.Error(w, err.Error(), 500) return } defer resultFile.Close() _, err = io.Copy(resultFile, file) if err != nil { http.Error(w, err.Error(), 500) return } } 15