levigross / grequests

A Go "clone" of the great and famous Requests library
Apache License 2.0
2.14k stars 138 forks source link

how to post a file using file received from gin's c.FormFile? #87

Closed aurorazl closed 5 days ago

aurorazl commented 4 years ago

I received a file through gin's c.FormFile. file, err := c.FormFile("image") How can i send it to other server through grequests? Thanks.

aurorazl commented 4 years ago

Can grequests post a file from []byte or string?

aurorazl commented 4 years ago

Solved it! []grequests.FileUpload{{FileName: "image",FileContents: ioutil.NopCloser(bytes.NewReader(image))}