Upload a file and save on www folder in Shiny

  Kiến thức lập trình

The app basically get the uploaded file and saves it on the www/img folder.

This app receive the jpg file and saves on www/imgfolder

I can save the first one.

But when I upload the second it doesnt work anymore

library(shiny)

#File name:

# IMG_1805


ui <- fluidPage(

  fileInput(
  "file1",
  "jpg image",
  accept = c('image/jpeg', 'image/jpg')


))

server <- function(input, output, session) {

  output$main_image <- renderUI({
    req(input$file1)

    file.copy(input$file1$datapath, "www/img/")
  })

}


shinyApp(ui, server)

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT