plumber icon indicating copy to clipboard operation
plumber copied to clipboard

Multi file upload

Open ThHarbig opened this issue 4 years ago • 4 comments

I'm using the development version of plumber due to the newly implemented multipart/form-data file upload. I'd like to be able to send an arbitrary number of files to the server. As a workaround I'm sending the files separately and save them in a global variable. However, I think this feature might still be valuable to some users.

ThHarbig avatar Jul 01 '20 07:07 ThHarbig

See #575,

Do you use swagger UI or you do it directly through a CURL command?

meztez avatar Jul 01 '20 13:07 meztez

I'm using javascript axios (but I also tried it via the swagger UI)

ThHarbig avatar Jul 02 '20 08:07 ThHarbig

if you define your endpoint as

#* @post /endpoint
function(...) {
  files <- list(...)
  files <- files[!names(files) %in% c("req", "res")]
  #list of files in the form list(nm = rawbytes, nm = rawbytes, ...)
}

It should work for now (not in swagger) until we come up with a better solutions.

meztez avatar Jul 02 '20 13:07 meztez

Swagger has been updated. This should work.

#* @param f:[file]
#* @post /upload
function(f) {
  names(f)
}

Closable

meztez avatar Oct 01 '20 22:10 meztez