fehlerbehebung
This commit is contained in:
parent
034de7fffc
commit
1359026aaa
37
http.go
37
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,9 +44,25 @@ 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("date: " + date[0])
|
|
||||||
logger("----------------POST END----------------")
|
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("----------------POST END----------------")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue