Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Uploading file and json #43

Closed
jchannon opened this issue Nov 10, 2015 · 3 comments
Closed

Uploading file and json #43

jchannon opened this issue Nov 10, 2015 · 3 comments

Comments

@jchannon
Copy link
Contributor

Hi

Is it possible to upload a json body and a file and for this lib to work? Currently I either get back a ContentType error or a Deserialization error

Thanks 😄

@jchannon
Copy link
Contributor Author

I've realised thats not possible and the payload would have to be multipart and I can get that to bind now however when I then try to access files by invoking the multipartreader again it throws an error I think because the binder has already read the body and assigned the Multipartform property

@jchannon
Copy link
Contributor Author

OK I have got it binding and I can access the files. However when you read the form values and assign the Multipartform property you reading it all in one go. Would you accept a PR to use r.MultipartReader() that way it doesnt store the memory temporarily to disk and should improve perf if people are uploading big files

@jchannon
Copy link
Contributor Author

Ah my mistake you are using r.MultipartReader but call ReadForm up to 10mb instead of calling NextPart

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant