View source: R/selectFileModule.r
selectFileServer | R Documentation |
Module Server function for file selection
selectFileServer(id, root_dirs = c(root = "."), filetypes = NULL)
id |
string namespace id for module (same as in server) |
root_dirs |
named list of paths that for the root directories within which files may be selected default is the cwd ie c(root = ".")) |
filetypes |
vector of filetypes (by file extension) that may be selected from eg c("txt", "csv", "gpkg") |
Select File Module UI used with selectFileUI modified from https://stackoverflow.com/questions/38747129/how-to-use-shinyfiles-package-within-shiny-modules-namespace-issue
filepath as reactiveValue named same as module id ( relative to root_dirs argument in fileSelectServer)
#simple file selection shiny app
library(shiny)
ui <- fluidPage(
selectFileUI(
id = "fileSelect1",label ="Select File"
),
textOutput("datapath")
)
server <- function(input, output, session) {
rv<-reactiveValues()
x <- selectFileServer(id = "fileSelect1")
observe(rv$datapath<-x$datapath)
observe(output$datapath<-renderText(rv$datapath))
}
shinyApp(ui,server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.