I'm having trouble uploading a file in R shiny. What I'm trying to do is, I use the browse button to select the file (file.csv) from folder A and upload it to folder B, but when I see folder B, the file name appears to be "Bfile.csv" after uploading. I'm not sure why the file is being renamed when I upload it.
someone assist me how to solve this issue in R shiny
Below is the code.
library(shiny)
library(here)
#path for folder B, where the file to be stored after uploading
file_path<- here('inputfolder/B')
ui <- shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
fileInput('file1', 'Select file to upload' )
),
mainPanel(
h4('List of uploaded files:')
,verbatimTextOutput('fileList')
)
))
)
server <- shinyServer(function(input, output) {
observe({
if (is.null(input$file1) ) { return(NULL) }
file.copy(from = input$file1$datapath, to = paste0(xptpath,input$file1$name ) )
})
})
shinyApp(ui, server)