fileInput.RdUpload files to the server.
fileInput( id, placeholder = "Choose file", browse = "Browse", ..., multiple = TRUE, accept = NULL )
| id | A character string specifying the id of the reactive input. |
|---|---|
| placeholder | A character string specifying the text inside the file
input, defaults to |
| browse | A character string specifying the label of file input, defaults
to |
| ... | Additional named arguments passed as HTML attributes to the parent element or tag elements passed as child elements to the parent element. |
| multiple | One of |
| accept | A character vector of possible MIME types or file extensions,
defaults to |
shinyApp(
ui = container(
fileInput("upload") %>%
margin(0, "auto", 0, "auto")
),
server = function(input, output) {
observe({
req(input$upload)
print(input$upload)
})
}
)
Other inputs:
buttonGroupInput(),
buttonInput(),
checkbarInput(),
checkboxInput(),
chipInput(),
formInput(),
listGroupInput(),
menuInput(),
navInput(),
radioInput(),
radiobarInput(),
rangeInput(),
selectInput(),
textInput()
### Standard file input fileInput(id = "file1")#> <div class="yonder-file custom-file" id="file1"> #> <input type="file" class="custom-file-input" multiple autocomplete="off"/> #> <label class="custom-file-label" data-browse="Browse">Choose file</label> #> <div class="valid-feedback"></div> #> <div class="invalid-feedback"></div> #> </div>### Adding a button fileInput( id = "file2", left = buttonInput("upload", "Upload") %>% background("green") )#> <div class="yonder-file custom-file" id="file2" left="<button class="yonder-button btn btn-green" type="button" role="button" id="upload" autocomplete="off">Upload</button>"> #> <input type="file" class="custom-file-input" multiple autocomplete="off"/> #> <label class="custom-file-label" data-browse="Browse">Choose file</label> #> <div class="valid-feedback"></div> #> <div class="invalid-feedback"></div> #> </div>### Customizing text fileInput( id = "file3", placeholder = "Pick a file", browse = "Go go go!" )#> <div class="yonder-file custom-file" id="file3"> #> <input type="file" class="custom-file-input" multiple autocomplete="off"/> #> <label class="custom-file-label" data-browse="Go go go!">Pick a file</label> #> <div class="valid-feedback"></div> #> <div class="invalid-feedback"></div> #> </div>