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

Allow file uploads with io.Reader and a name #21

Closed
mrd0ll4r opened this issue Jan 16, 2016 · 4 comments
Closed

Allow file uploads with io.Reader and a name #21

mrd0ll4r opened this issue Jan 16, 2016 · 4 comments
Assignees

Comments

@mrd0ll4r
Copy link

Hey, first of all: thanks for this wonderful library! I've been using it for quite some time now, and it works like a charm.

There's one thing I'm missing, though: being able to upload files (as multipart) using an io.Reader and a name for the file. The scenario is, for example, something like this:

I have a database of many small image files which are stored as BLOBs along with their original file name (or file type). I want to upload some of them to some endpoints, I know the server will check the extension of the file name to determine if I really send images. It'd be great if I could directly "pipe" the image from the DB along with its name (or a made up name) into resty. It's a pain to create temporary files for every upload I need (imagine the DB running on another machine)...

Other scenarios might include receiving files over the network - I don't want to store a copy locally, I just want to pipe them through.

Would it be possible to get that? I'm thinking of something like

func (r *Request) SetFileReader(param, fileName string, reader io.Reader) *Request

What do you think?

@jeevatkm jeevatkm self-assigned this Jan 16, 2016
@jeevatkm jeevatkm added this to the v0.6 Milestone milestone Jan 16, 2016
@jeevatkm
Copy link
Member

I'm glad to hear library is helpful for you :) Sure, your scenario is real usage need. I will bring it in next release. Signature looks good.

If you think of any feature would be helpful in resty for users, please let me know. I will bring it in.

@jeevatkm
Copy link
Member

Added io.Reader support, available in master. Give a try and let me know your feedback!

Will be released as part of v0.6 then it will be available via gopkg.in/resty.v0.

@mrd0ll4r
Copy link
Author

Hey, sorry to re-open this, but: thanks! Works like a charm.
There is one line of log output, but I guess you know about that :)

@jeevatkm
Copy link
Member

Yep, log line removed now. Thanks of verifying functionality :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants