-
Notifications
You must be signed in to change notification settings - Fork 256
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
Provide a clean way to upload files via an endpoint #75
Comments
I had not seen your ticket when I sent some code for review yesterday (see #77). In my notes I suggest something that seems similar to what you are suggesting:
That would pretty much do what you suggest right? If so I will change the submission to make it generic, so that it just returns the binary, to be handled by the endpoint. |
My use case was different, but I think that any solution will end up being applicable to both use cases. |
I think #77 is the ground work for this feature. This would be really nice but I think there's a decent chunk of work to get us there. |
Is there any problem with using
And it seems to work with |
@liori So cool !! somefile <- readLines(con = formContents$upload$tempfile) If the file is some kind of binary file, then we can do: somefile <- readBin(con = formContents$upload$tempfile, "raw",
n = file.size(formContents$upload$tempfile)) |
@liori @ZJUguquan How can i deal with multiple file from front end |
Anyone on this thread aware of configuration settings that would control how large of a file we can upload using the techniques described here? I configured an app as described, which works for small files. But for larger files it just sort of hangs and never completes. |
Do we know what annotation to be provided in R function to generate swagger with file upload support? |
Thanks for the suggestion @liori .
can you see what is wrong? plumber.R
|
|
@krlmlr your uploader worked like a charm for excel files. Thanks! |
Fixed in #532. Closing. Please open a new issue and reference this one if you run into any issues! Thank you. |
Posting whole files to an endpoint, using the "multipart/formdata" enctype is not currently well supported.
It is possible to retrieve a posted file (see https://github.com/sellorm/plumber-uploader for an example), but this is hacky and fragile at best. This approach basically rips the file name and content from
req$postBody
.It would be useful to have something like a
req$FILES
that could be parsed to obtain filenames and content, for processing by the endpoint author.Not sure how you'd handle things like accepted file types, or max permitted file size and so on though.
The text was updated successfully, but these errors were encountered: