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