2014-08-10 05:11
浏览 43


I have a html page that has the follow code.

<form action="/image" method="post"
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">

I then have some Go code to get the file on the back end.

func uploaderHandler(w http.ResponseWriter, r *http.Request) {

   userInput := r.FormValue("file")

but anytime I try to use userInput from the go script, it returns nothing. Am I passing the variables wrong?

EDIT: I know how to upload things to golang that are text/passwords. I am having trouble uploading images to Go with the code.

EDIT 2: Read the Go guide a found the solution. See below.

1条回答 默认 最新

相关推荐 更多相似问题