shinyFilesDropBox-parsers: Convert the output of a selection to platform specific...

Description Usage Arguments Details Value See Also Examples

Description

This function takes the value of a shinyFiles button input variable and converts it to be easier to work with on the server side. In the case of file selections and saving the input variable is converted to a data frame (using parseDropFilePaths() or parseDropSavePath() respectively) of the same format as that provided by fileInput. The only caveat here is that the MIME type cannot be inferred in file selections so this will always be an empty string and new files doesn't have a size so this is left out with file saving. In the case of folder selection the input variable is converted to a string (using parseDropDirPath()) giving the absolute path to the selected folder.

Usage

1
2
3
4
5
parseDropFilePaths(selection, roots = c(Home = ""))

parseDropDirPath(selection, roots = c(Home = ""))

parseDropSavePath(selection, roots = c(Home = ""))

Arguments

selection

The corresponding input variable to be parsed

roots

The path to the root as specified in the shinyDropFileChoose() call in shinyServer()

Details

The use of parseDropFilePaths makes it easy to substitute fileInput and shinyFiles in your code as code that relies on the values of a file selection doesn't have to change.

Value

A data frame mathcing the format of fileInput

See Also

Other shinyFilesDropBox: shinyDropFilesExample, shinyFilesDropBox-buttons, shinyFilesDropBox-observers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
token = drop_auth(new_user = FALSE, cache=TRUE)
ui <- shinyUI(bootstrapPage(
shinyDropFilesButton('files', 'File select', 'Please select a file', FALSE),
verbatimTextOutput('rawInputValue'),
verbatimTextOutput('filepaths')
))

server <- shinyServer(function(input, output,session) {
shinyDropFileChoose(input, 'files',session = session, dtoken =token)
output$rawInputValue <- renderPrint({str(input$files)})
output$filepaths <- renderPrint({parseDropFilePaths(input$files)})
})

## End(Not run)

armelmoth/shinyFilesDropBox documentation built on May 17, 2019, 11:14 p.m.