github.com/aarzilli/tools@v0.0.0-20151123112009-0d27094f75e0/net/http/upload/11_post_html_form.go (about) 1 package upload 2 3 import ( 4 "net/http" 5 6 "github.com/pbberlin/tools/net/http/loghttp" 7 "github.com/pbberlin/tools/net/http/tplx" 8 9 tt "html/template" 10 ) 11 12 var str = ` 13 <style> 14 span.b { 15 display:inline-block; 16 width: 150px; 17 align:middle; 18 } 19 </style> 20 <form 21 action='{{.Url}}?getparam1=val1' 22 method='post' 23 enctype='multipart/form-data' 24 style='line-height:32px;padding:8px;' 25 > 26 <span class='b' >Datei</span> 27 <input 28 type='file' 29 name='filefield' 30 acceptxx='application/zip, image/gif, image/jpeg' 31 accept='application/zip' 32 accesskey='w' 33 /><br> 34 35 <span class='b' >MountName </span> 36 <input name='mountname' type='text' value='mnt02' length=5 /><br> 37 38 39 <span class='b' > </span> 40 <input type='submit' value='submit1' accesskey='s' /><br> 41 42 </form> 43 44 ` 45 var tplBase = tt.Must(tt.New("tplName01").Parse(str)) 46 47 func sendUpload(w http.ResponseWriter, r *http.Request, m map[string]interface{}) { 48 49 lg, _ := loghttp.Logger(w, r) 50 // c := appengine.NewContext(r) 51 52 wpf(w, tplx.ExecTplHelper(tplx.Head, map[string]interface{}{"HtmlTitle": "Post an Upload"})) 53 defer wpf(w, tplx.Foot) 54 55 tData := map[string]string{"Url": UrlUploadReceive} 56 err := tplBase.ExecuteTemplate(w, "tplName01", tData) 57 if err != nil { 58 lg("tpl did not compile: %v", err) 59 } 60 61 }