working on file upload
This commit is contained in:
parent
2de0705ecc
commit
63da33a8ca
8
http.go
8
http.go
|
@ -24,20 +24,22 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
|
||||||
s.data = "null"
|
s.data = "null"
|
||||||
http.HandleFunc("/"+urlPath, func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/"+urlPath, func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method == "POST" {
|
if r.Method == "POST" {
|
||||||
|
r.ParseMultipartForm(10 << 20)
|
||||||
err := r.ParseForm()
|
err := r.ParseForm()
|
||||||
errorPanic(err)
|
errorPanic(err)
|
||||||
|
|
||||||
if filepath == "./web/pages/admin/dashboard.html" {
|
if filepath == "./web/pages/admin/dashboard.html" {
|
||||||
title := r.FormValue("title")
|
title := r.FormValue("title")
|
||||||
description := r.FormValue("description")
|
description := r.FormValue("description")
|
||||||
files := r.FormValue("media")
|
media, media_header, err := r.FormFile("media")
|
||||||
|
errorPanic(err)
|
||||||
date := r.FormValue("date")
|
date := r.FormValue("date")
|
||||||
|
|
||||||
if title != "" && description != "" && files != "" && date != "" {
|
if title != "" && description != "" && media != nil && date != "" {
|
||||||
logger("----------------POST----------------")
|
logger("----------------POST----------------")
|
||||||
logger("title: " + title)
|
logger("title: " + title)
|
||||||
logger("descrtiption: " + description)
|
logger("descrtiption: " + description)
|
||||||
logger("media: " + files)
|
logger("media: " + media_header.Filename)
|
||||||
logger("date: " + date)
|
logger("date: " + date)
|
||||||
logger("----------------POST END----------------")
|
logger("----------------POST END----------------")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue