Skip to contents

Create a file upload control that can be used to upload one or more files.

Usage

f7File(
  inputId,
  label,
  multiple = FALSE,
  accept = NULL,
  width = NULL,
  buttonLabel = "Browse...",
  placeholder = "No file selected"
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

multiple

Whether the user should be allowed to select and upload multiple files at once. Does not work on older browsers, including Internet Explorer 9 and earlier.

accept

A character vector of MIME types; gives the browser a hint of what kind of files the server is expecting.

width

The width of the input, e.g. 400px.

buttonLabel

The label used on the button. Can be text or an HTML tag object.

placeholder

The text to show before a file has been uploaded.

Examples

if (interactive()) {
  library(shiny)
  library(shinyMobile)

  ui <- f7Page(
    f7SingleLayout(
      navbar = f7Navbar(title = "File handling"),
      f7Block(f7File("up", "Upload!"))
    )
  )

  server <- function(input, output) {
    data <- reactive(input$up)
    observe(print(data()))
  }

  shinyApp(ui, server)
}