Skip to content

thomasp85/shinyFiles

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
August 19, 2022 15:32
April 26, 2022 23:54
man
January 5, 2023 14:40
May 24, 2022 13:20
January 28, 2020 12:05
January 5, 2023 14:40
October 31, 2020 05:04
August 19, 2022 15:32
November 10, 2021 08:20
August 19, 2022 15:37
January 25, 2019 17:46

shinyFiles

R-CMD-check CRAN_Release_Badge CRAN_Download_Badge

This package extends the functionality of shiny by providing an API for client side access to the server file system. As many shiny apps are run locally this is equivalent to accessing the filesystem of the users own computer, without the overhead of copying files to temporary locations that is tied to the use of fileInput().

The package can be installed from CRAN using install.packages('shinyFiles').

Usage

The package is designed to make it extremely easy to implement file system access. An example of implementing a file chooser would be:

In the ui.R file

shinyUI(bootstrapPage(
    shinyFilesButton('files', label='File select', title='Please select a file', multiple=FALSE)
))

In the server.R file

shinyServer(function(input, output) {
    shinyFileChoose(input, 'files', root=c(root='.'), filetypes=c('', 'txt'))
})

It is equally simple to implement directly in your custom html file as it only requires a single <button> element. The equivalent of the above in raw html would be:

<button id="files" type="button" class="shinyFiles btn" data-title="Please select a file" data-selecttype="single">
    File select
</button>

For an overview of all the different modules try the shinyFilesExample() function in the package. It gives an overview of all the necessary code, along with descriptions and working examples.

Credits

  • The file icons used in the file system navigator are taken from FatCows Farm-Fresh Web Icons (https://www.fatcow.com/free-icons)
  • RStudio is a trademark of RStudio, Inc. File icons used by permission of RStudio, Inc.