Learn R Programming

yonder (version 0.2.0)

fileInput: File inputs

Description

Upload files to the server.

Usage

fileInput(
  id,
  placeholder = "Choose file",
  browse = "Browse",
  ...,
  multiple = TRUE,
  accept = NULL
)

Arguments

id

A character string specifying the id of the reactive input.

placeholder

A character string specifying the text inside the file input, defaults to "Choose file".

browse

A character string specifying the label of file input, defaults to "Browse".

...

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 TRUE or FALSE specifying whether or not the user can upload multiple files at once, defaults to TRUE.

accept

A character vector of possible MIME types or file extensions, defaults to NULL, in which case any file type may be selected.

<strong>Example</strong> uploading a file

shinyApp(
  ui = container(
    fileInput("upload") %>%
      margin(0, "auto", 0, "auto")
  ),
  server = function(input, output) {
    observe({
      req(input$upload)

print(input$upload) }) } )

See Also

Other inputs: buttonGroupInput(), buttonInput(), checkbarInput(), checkboxInput(), chipInput(), formInput(), listGroupInput(), menuInput(), navInput(), radioInput(), radiobarInput(), rangeInput(), selectInput(), textInput()

Examples

Run this code
# NOT RUN {
### Standard file input

fileInput(id = "file1")

### Adding a button

fileInput(
  id = "file2",
  left = buttonInput("upload", "Upload") %>%
    background("green")
)

### Customizing text

fileInput(
  id = "file3",
  placeholder = "Pick a file",
  browse = "Go go go!"
)

# }

Run the code above in your browser using DataLab