fehlerbehebung
This commit is contained in:
parent
b4100d9057
commit
f8097dd54f
35
http.go
35
http.go
|
@ -31,22 +31,7 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
|
||||||
|
|
||||||
formdata := r.MultipartForm
|
formdata := r.MultipartForm
|
||||||
|
|
||||||
files := formdata.File["multiplefiles"] // grab the filenames
|
files := formdata.File["media"]
|
||||||
|
|
||||||
logger("files uploaded successfully : ")
|
|
||||||
|
|
||||||
for i, _ := range files { // loop through the files one by one
|
|
||||||
file, err := files[i].Open()
|
|
||||||
errorPanic(err)
|
|
||||||
|
|
||||||
out, err := os.Create("./web/images/" + files[i].Filename)
|
|
||||||
errorPanic(err)
|
|
||||||
|
|
||||||
_, err = io.Copy(out, file)
|
|
||||||
errorPanic(err)
|
|
||||||
|
|
||||||
logger(files[i].Filename)
|
|
||||||
}
|
|
||||||
|
|
||||||
if filepath == "./web/pages/admin/dashboard.html" {
|
if filepath == "./web/pages/admin/dashboard.html" {
|
||||||
title := formdata.Value["title"]
|
title := formdata.Value["title"]
|
||||||
|
@ -59,11 +44,27 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
|
||||||
logger("title: " + title[0])
|
logger("title: " + title[0])
|
||||||
logger("descrtiption: " + description[0])
|
logger("descrtiption: " + description[0])
|
||||||
logger("media: " + string(len(media)))
|
logger("media: " + string(len(media)))
|
||||||
|
|
||||||
|
logger("files uploaded successfully : ")
|
||||||
|
|
||||||
|
for i, _ := range files {
|
||||||
|
file, err := files[i].Open()
|
||||||
|
errorPanic(err)
|
||||||
|
|
||||||
|
out, err := os.Create("./web/images/" + files[i].Filename)
|
||||||
|
logger("unable to create the file '" + "./web/images/" + files[i].Filename + "' for writing. Check your write access privilege")
|
||||||
|
errorPanic(err)
|
||||||
|
|
||||||
|
_, err = io.Copy(out, file)
|
||||||
|
errorPanic(err)
|
||||||
|
|
||||||
|
logger(files[i].Filename)
|
||||||
|
}
|
||||||
|
}
|
||||||
logger("date: " + date[0])
|
logger("date: " + date[0])
|
||||||
logger("----------------POST END----------------")
|
logger("----------------POST END----------------")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logger(r.Method + " request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">")
|
logger(r.Method + " request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue