MultiPart Form upload multiple files

396 views
Skip to first unread message

will

unread,
Jan 28, 2016, 1:40:05 AM1/28/16
to golang-nuts
Dear Gophers,

I am trying to upload 3 files(multiple).

<form action="uploadMultipleFiles" method="post" enctype="multipart/form-data">
<input type="file" name="myfile1" required /><br />
<input type="file" name="myfile2" required /><br />
<input type="file" name="myfile3" required /><br />
<input type="submit" value="Submit" id="submitForm" name="submitForm" >
</form>

How do i extract the names of the part of the form being uploaded? i.e. how do i differentiate what was uploaded in myfile1 from myfile3. How do i extract the "myfilex" string
 
for _, fileHeaders := range r.MultipartForm.File { for _, fileHeader := range fileHeaders {..}
}

Brad Fitzpatrick

unread,
Jan 28, 2016, 12:41:33 PM1/28/16
to will, golang-nuts
You're assigning your sought answer to _.

https://golang.org/pkg/mime/multipart/#Form ... "Both are keyed by field name."


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages