title: clear (reset) upload file input in R Shiny
body: <p>I am building a shiny app which basically upload multiple shape files (dbf,prj,shp,shx) and creates map using leaflet package. Once the upload is done and map is created , there is reset button whose function is to clear/reset the existing values of the file input though I tried doing the same using shinyjs as well but still it seems that file Input caches the value. Below is the code which I tried out. Looking for tips to rest the file Input in below case.</p>
  
  <pre><code>## app.R ##
  library(shinydashboard)
  library(shinyjs)
  library(leaflet)
  library(sp)
  library(rgdal)
  
  ui &lt;- dashboardPage(
    dashboardHeader(title = "Basic dashboard"),
    dashboardSidebar(
  
      fileInput('uploadFile', 'Upload Files',
                accept=c('text/csv', 'text/comma-separated-values,text/plain'), multiple=T),
  
      fileInput('uploadFile2', 'Upload Files 2',
                accept=c('text/csv', 'text/comma-separated-values,text/plain'), multiple=T),
  
      actionButton('reset', 'Reset', icon = icon("minus"),style="color:rgb(57,156,8);border-color:rgb(57,156,8)"),
      tags$style(type='text/css', "#reset {margin-left: 10px;}")
  
    ),
    dashboardBody(
  
      useShinyjs(),
  
      leafletOutput("GeoStates",width = "125%", height = 500)
  
    )
  )
  
  server &lt;- function(input, output) {
  
    # Folder name and uploaded file names 
    values &lt;- reactiveValues(
      folderName = "dataSource",
      fileName = ""
    )
  
    # Expression for reading the OGR and transforming it
    expr_q &lt;- quote({ 
  
      if(values$fileName == "") 
        return (NULL)
      spTransform(readOGR(dsn = paste0(getwd(),"/",values$folderName), layer = values$fileName), 
                  CRS("+proj=longlat +datum=WGS84"))
  
    })
  
    ORG0 &lt;- reactive(expr_q, quoted = TRUE)
  
    # Upload file 
    observe({
      if (!is.null(input$uploadFile)){
        hide(id = "uploadMsgBox", anim = TRUE)
        if(!dir.exists(values$folderName))
          dir.create(values$folderName,recursive = TRUE)
        for(i in 1:nrow(input$uploadFile)){
          values$fileName &lt;- substr(input$uploadFile[i,1],0,nchar(input$uploadFile[i,1])-4)
          file.copy(input$uploadFile[i,4],paste0(getwd(),"/",values$folderName,"/",input$uploadFile[i,1]))
        }
      }
    })
  
    # -------------------------------------------------------------------------------------------------------------------------------
    # -------------------------------------------------------------------------------------------------------------------------------
  
    # Folder name and uploaded file names
  
    values2 &lt;- reactiveValues(
      folderName2 = "dataSource2",
      fileName2 = ""
    )
  
    expr_q2 &lt;- quote({
  
      if(values2$fileName2 == "")
        return (NULL)
      spTransform(readOGR(dsn = paste0(getwd(),"/",values2$folderName2), layer = values2$fileName2),
                  CRS("+proj=longlat +datum=WGS84"))
    })
  
    ORG2 &lt;- reactive(expr_q2, quoted = TRUE)
  
    # Upload file 2
    observe({
      if (!is.null(input$uploadFile2)){
        hide(id = "uploadMsgBox2", anim = TRUE)
        if(!dir.exists(values2$folderName2))
          dir.create(values2$folderName2,recursive = TRUE)
        for(i in 1:nrow(input$uploadFile2)){
          values2$fileName2 &lt;- substr(input$uploadFile2[i,1],0,nchar(input$uploadFile2[i,1])-4)
          file.copy(input$uploadFile2[i,4],paste0(getwd(),"/",values2$folderName2,"/",input$uploadFile2[i,1]))
        }
      }
    })
  
    #------------------------------------------------------------------------------------------------------------------
    #------------------------------------------------------------------------------------------------------------------
  
    observeEvent(input$reset, {
  
      values$fileName == ""
      values2$fileName2 == ""
  
      ORG0 &lt;- NULL
      ORG2 &lt;- NULL
  
      shinyjs::reset('uploadFile')
      shinyjs::reset('uploadFile2')
  
      unlink(paste0(getwd(),"/dataSource"), recursive = TRUE)
      unlink(paste0(getwd(),"/dataSource2"), recursive = TRUE)
  
      output$GeoStates &lt;- renderLeaflet({ })
  
    })
  
    #----------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------------------------------------------------------
  
    observe({
  
     if (!is.null(input$uploadFile) &amp; is.null(input$uploadFile2)){
  
      print("TEST1")
  
      output$GeoStates &lt;- renderLeaflet({
  
        leaflet(data = ORG0()) %&gt;% addTiles() %&gt;% addPolygons(fill = FALSE, stroke = TRUE, color = "#0090C5") %&gt;%
          addLegend("bottomright", colors = "#0090C5", labels = values$fileName) %&gt;%
          addProviderTiles(providers$Esri.WorldImagery,
                           options = providerTileOptions(noWrap = TRUE))%&gt;%
          addScaleBar(position = "topright", options = scaleBarOptions(metric = TRUE))
  
      })
  
    }
  
  
    if (!is.null(input$uploadFile) &amp; !is.null(input$uploadFile2)){
  
      print("TEST2")
  
      output$GeoStates &lt;- renderLeaflet({
  
        leaflet(data = ORG0()) %&gt;% addTiles() %&gt;% addPolygons(fill = FALSE, stroke = TRUE, color = "#0090C5") %&gt;%
          addLegend("bottomright", colors = "#0090C5", labels = values$fileName) %&gt;%
          addProviderTiles(providers$Esri.WorldImagery,
                           options = providerTileOptions(noWrap = TRUE))%&gt;%
          addPolygons(fill = FALSE, stroke = TRUE, color = "#F39200", data = ORG2())%&gt;%
          addScaleBar(position = "topright", options = scaleBarOptions(metric = TRUE))
  
      })
  
    }
  
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>