shinyFilesDropBox-observers: Create a connection to the server side filesystem

Description Usage Arguments Details Value See Also Examples

Description

These function sets up the required connection to the client in order for the user to navigate the filesystem. For this to work a matching button should be present in the html, either by using one of the button generating functions or adding it manually. See shinyFiles-buttons for more details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
shinyDropFileChoose(input, id, updateFreq = 1e+05,
  session = getDropSession(), defaultRoot = NULL, defaultPath = "",
  dtoken, ...)

shinyDropDirChoose(input, id, updateFreq = 1e+05,
  session = getDropSession(), defaultPath = "", defaultRoot = NULL,
  dtoken, ...)

shinyDropFileSave(input, id, updateFreq = 1e+05, session = getDropSession(),
  defaultPath = "", defaultRoot = NULL, dtoken, ...)

Arguments

input

The input object of the shinyServer() call (usaully input)

id

The same ID as used in the matching call to shinyDropFilesButton or as the id attribute of the button, in case of a manually defined html. This id will also define the id of the file choice in the input variable

updateFreq

The time in milliseconds between file system lookups. This determines the responsiveness to changes in the filesystem (e.g. addition of files or drives)

session

The session object of the shinyServer call (usually session).

defaultRoot

The default root to use. For instance if roots = c(Home = '', Home2='/home') then defaultRoot can be either 'Home' or 'Home2'.

defaultPath

The default relative path specified given the defaultRoot.

dtoken

The Dropbox token generated by drop_auth (package rdrop2).

...

Arguments to be passed on to fileGetterFile or dirDropGetter

Details

Restrictions on the access rights of the client can be given in several ways. The root parameter specifies the starting position for the filesystem as presented to the client. This means that the client can only navigate in subdirectories of the root. Paths passed of to the restrictions parameter will not show up in the client view, and it is impossible to navigate into these subdirectories. The filetypes parameter takes a vector of file extensions to filter the output on, so that the client is only presented with these filetypes. Whenever a file or folder choice is made the resulting files/folder will be accessible in the input variable with the id given in the parameters. This value should probable be run through a call to one of the parser (shinyDropFiles-parsers) in order to get well formatted paths to work with.

Value

A reactive observer that takes care of the server side logic of the filesystem connection.

See Also

Other shinyFilesDropBox: shinyDropFilesExample, shinyFilesDropBox-buttons, shinyFilesDropBox-parsers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## Not run: 
# File selections
token = drop_auth(new_user = FALSE, cache=TRUE)
ui <- shinyUI(bootstrapPage(
    shinyDropFilesButton('files', 'File select', 'Please select a file', FALSE)
))
server <- shinyServer(function(input, output,session) {
    shinyDropFileChoose(input, 'files',session = session, dtoken =token)
})

runApp(list(
    ui=ui,
    server=server
))

## End(Not run)

## Not run: 
# Folder selections
token = drop_auth(new_user = FALSE, cache=TRUE)
ui <- shinyUI(bootstrapPage(
shinyDropDirButton('folder', 'Folder select', 'Please select a folder', FALSE),
verbatimTextOutput('rawInputValue'),
verbatimTextOutput('filepaths')
))
server <- shinyServer(function(input, output,session) {

shinyDropDirChoose(input, 'folder', session = session,dtoken=token)
output$rawInputValue <- renderPrint({str(input$folder)})
output$filepaths <- renderPrint({parseDropDirPath(input$folder)})
})
runApp(list(
    ui=ui,
    server=server
))

## End(Not run)

## Not run: 
# File selections
token = drop_auth(new_user = FALSE, cache=TRUE)
ui <- shinyUI(bootstrapPage(
    shinyDropSaveButton('save', 'Save', 'Save as...'),
    verbatimTextOutput('rawInputValue'),
    verbatimTextOutput('filepaths')
))
server <- shinyServer(function(input, output, session) {
    shinyDropFileSave(input, 'save',session=session,dtoken=token)
    output$rawInputValue <- renderPrint({str(input$save)})
    output$filepaths <- renderPrint({parseDropSavePath(input$save)})
})

runApp(list(
    ui=ui,
    server=server
))

## End(Not run)

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