forked from daattali/advanced-shiny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
35 lines (30 loc) · 799 Bytes
/
app.R
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
library(shiny)
fixUploadedFilesNames <- function(x) {
if (is.null(x)) {
return()
}
oldNames = x$datapath
newNames = file.path(dirname(x$datapath),
x$name)
file.rename(from = oldNames, to = newNames)
x$datapath <- newNames
x
}
ui <- fluidPage(
fileInput("file", "Choose files", multiple = TRUE),
h3("Original file input value"),
dataTableOutput("originalfiles"),
h3("New file input value"),
dataTableOutput("newfiles")
)
server <- function(input, output, session) {
output$originalfiles <- renderDataTable(
input$file,
options = list(dom = "", searching = FALSE)
)
output$newfiles <- renderDataTable(
fixUploadedFilesNames(input$file),
options = list(dom = "", searching = FALSE)
)
}
shinyApp(ui = ui, server = server)