fehlerbehebung
This commit is contained in:
parent
b4100d9057
commit
f8097dd54f
37
http.go
37
http.go
|
@ -31,22 +31,7 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
|
|||
|
||||
formdata := r.MultipartForm
|
||||
|
||||
files := formdata.File["multiplefiles"] // grab the filenames
|
||||
|
||||
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)
|
||||
}
|
||||
files := formdata.File["media"]
|
||||
|
||||
if filepath == "./web/pages/admin/dashboard.html" {
|
||||
title := formdata.Value["title"]
|
||||
|
@ -59,9 +44,25 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
|
|||
logger("title: " + title[0])
|
||||
logger("descrtiption: " + description[0])
|
||||
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