Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Binding Not Working! #14

Closed
bnuby opened this issue Apr 28, 2019 · 3 comments
Closed

File Binding Not Working! #14

bnuby opened this issue Apr 28, 2019 · 3 comments

Comments

@bnuby
Copy link

bnuby commented Apr 28, 2019

type UpdateUserOperatorReq struct {
	File     *multipart.FileHeader `form:"file"`
	UID      *string                        `form:"uid" json:"uid"`
}

...

req := &UpdateUserOperatorReq{}
if err := c.ShouldBind(req); err != nil {
	c.JSON(status, "")
	return
}
logger(req.File)
// <nil>

I follow the example, but still getting nil. Please help fix this bug

@thinkerou
Copy link
Member

please see https://github.com/gin-gonic/examples/tree/master/file-binding
and you need to use gin master branch.

@bnuby
Copy link
Author

bnuby commented Apr 29, 2019

I Update my gin go get -u github.com/gin-gonic/gin
Also cant use.

Build failed
build github.com/xxxxxxx: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
	github.com/ugorji/go v1.1.4 (/go/pkg/mod/github.com/ugorji/[email protected]/codec)
	github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43 (/go/pkg/mod/github.com/ugorji/go/[email protected])

@bnuby
Copy link
Author

bnuby commented Apr 29, 2019

Fixed!
Follow #1673 Guide

@bnuby bnuby closed this as completed Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants