解析多部分表单时出错。做了以下尝试,但都没有解决: 不知道Golang是不是不支持rfc 1867。谢谢大家的帮助。
POST /uploadFile.htm HTTP/1.1
Host: myserver
Connection: keep-alive
Content-Length: 368
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="file"
Content-Type: multipart/form-data; boundary=BbC04y
--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain
... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
...contents of file2.gif...
--BbC04y--
--AaB03x--
err := request.ParseMultipartForm(1024)
log.Printf("value %v", request.MultipartForm.Value)
log.Printf("file %v", request.MultipartForm.File)
如果您查看日志,请查看以下内容
value map[file:[--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain
... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
...contents of file2.gif...
--BbC04y--]
file map[]
我应该怎么做才能解析多部分表单?