FIX specify upload enctype

This commit is contained in:
boyska 2018-01-05 23:39:41 +01:00
parent e62f7f5840
commit a6d5ca9141
2 changed files with 4 additions and 3 deletions

View file

@ -156,7 +156,8 @@ func (mu *MegaUploader) upload(w http.ResponseWriter, r *http.Request) {
} }
err = r.ParseMultipartForm(int64(sizelimit)) err = r.ParseMultipartForm(int64(sizelimit))
if err != nil { if err != nil {
http.Error(w, "Bad request", http.StatusBadRequest) fmt.Fprintln(os.Stderr, err)
http.Error(w, "Bad request: error parsing form", http.StatusBadRequest)
return return
} }
file, header, err := r.FormFile("file") file, header, err := r.FormFile("file")

View file

@ -23,8 +23,8 @@
</ul> </ul>
</div> </div>
<pre id="responses"></pre> <pre id="responses"></pre>
<form id="uploadForm" class="dropzone" method="POST" action="{{.Prefix}}/api/upload/{{.Share.Name}}"> <form id="uploadForm" class="dropzone" method="POST" action="{{.Prefix}}/api/upload/{{.Share.Name}}"
<noscript> enctype="multipart/form-data"> <noscript>
<input type="file" name="file" /> <input type="file" name="file" />
</noscript> </noscript>
</form> </form>