FileUploadUI: FileUploadUI

Description Usage Arguments Details Value See Also Examples

View source: R/FileUpload.R

Description

This file upload handler provides some functionalities for file uploading and possible renaming of uploaded files.

Usage

1
2
FileUploadUI(id, label, help = "Select files for upload.", rename = NULL,
  multiple = FALSE, horiz = FALSE)

Arguments

id

chr id of this object for shiny session

label

chr or NULL a lable/ title for the file upload

help

chr or NULL a help Text

rename

chr or NULL (NULL). If not NULL uploaded files can be renamed after upload. Value of rename will be used as a label above the renaming ui.

multiple

bool (FALSE) whether more than 1 file can be uploaded

horiz

bool (FALSE) whether ui elements should be placed horizontally, not vertically

Details

These are ui elements of the file upload handler, an error message and some text. In case rename is not NULL, several text input forms for renaming files are created after file upload.

Value

chr HTML for creating ui elements.

See Also

Other FileUpload module functions: FileUpload

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(shinyTools)

# check functions as example
check1 <- function(df, add){ if(any(grepl(add$type, df$type))) return(paste("Don't upload", add$type, "files."))}
check2 <- function(names, add){ if(any(grepl(add$pat, names))) return(paste("Don't use", add$pat, "in a file name."))}

# little app with module
ui <- fluidPage(sidebarLayout(
  sidebarPanel( width = 4, h2("FileUploadUI"),
                FileUploadUI("uploadID", "Upload File", rename = "Rename File", multiple = TRUE, horiz = TRUE)
  ),
  mainPanel( width = 8, h2("Return value of FileUpload"),
             verbatimTextOutput("content1")
  )
))
server <-function(input, output, session) {
  info <- callModule(FileUpload, "uploadID", rename = TRUE, checkNames = "check2", checkFiles = "check1",
                     addArgs = list(pat = "a", type = "text"))
  output$content1 <- renderPrint(info())
}
shinyApp(ui, server)

mRcSchwering/shinyTools documentation built on May 21, 2019, 10:14 a.m.