I need to have a pop-up window for when the uploaded file is not .csv file. The window information can be like "The .csv as file extension is allowed to be uploaded!". Unfortunately, I couldn't succeed in creating a pop-up window in Shiny so the code provided looks quite basic:
library(shiny)
shinyUI(
fluidPage(
fileInput("file1",
"Choose CSV files from directory",
multiple = TRUE,
accept=c('text/csv',
'text/comma-separated-values,text/plain',
'.csv')),
dataTableOutput("importcsv")))
server.R
library(shiny)
shinyServer(function(input, output) {
output$importcsv <- renderDataTable({
filecsv <- input$file1
if (is.null(filecsv)) {
return(NULL)
} else {
filecsv %>%
rowwise() %>%
do({
read.csv(.$datapath)
})
}
})
})