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

  multiple = FALSE,
  accept = NULL,
  width = NULL,
  buttonLabel = "Browse...",
  placeholder = "No file selected",
  capture = NULL



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


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


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.


A character vector of "unique file type specifiers" which gives the browser a hint as to the type of file the server expects. Many browsers use this prevent the user from selecting an invalid file.

A unique file type specifier can be:

  • A case insensitive extension like .csv or .rds.

  • A valid MIME type, like text/plain or application/pdf

  • One of audio/*, video/*, or image/* meaning any audio, video, or image type, respectively.


The width of the input, e.g. '400px', or '100%'; see validateCssUnit().


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


The text to show before a file has been uploaded.


What source to use for capturing image, audio or video data. This attribute facilitates user access to a device's media capture mechanism, such as a camera, or microphone, from within a file upload control.

A value of user indicates that the user-facing camera and/or microphone should be used. A value of environment specifies that the outward-facing camera and/or microphone should be used.

By default on most phones, this will accept still photos or video. For still photos only, also use accept="image/*". For video only, use accept="video/*".


Whenever a file upload completes, the corresponding input variable is set to a dataframe. See the Server value section.

Each time files are uploaded, they are written to a new random subdirectory inside of R's process-level temporary directory. The Shiny user session keeps track of all uploads in the session, and when the session ends, Shiny deletes all of the subdirectories where files where uploaded to.

Server value

A data.frame that contains one row for each selected file, and following columns:


The filename provided by the web browser. This is not the path to read to get at the actual data that was uploaded (see datapath column).


The size of the uploaded data, in bytes.


The MIME type reported by the browser (for example, text/plain), or empty string if the browser didn't know.


The path to a temp file that contains the data that was uploaded. This file may be deleted if the user performs another upload operation.


## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
      fileInput("file1", "Choose CSV File", accept = ".csv"),
      checkboxInput("header", "Header", TRUE)

server <- function(input, output) {
  output$contents <- renderTable({
    file <- input$file1
    ext <- tools::file_ext(file$datapath)

    validate(need(ext == "csv", "Please upload a csv file"))

    read.csv(file$datapath, header = input$header)

shinyApp(ui, server)