Where is updateFileInput?

shiny

#1

After uploading a file via fileInput, it shows the filename. How do I programmatically reset the displayed text to the default placeholder?

I am looking for a function that could be named updateFileInput


#2

Instead of the updateFileInput technique, could you use renderUI?

output$file_input <- renderUI({
  ...
  fileInput(...)
})

Here's a tutorial explaining the use: https://shiny.rstudio.com/articles/dynamic-ui.html


#3

I had use it in the young days of Shiny, but forgotten about it now everything is well-served. Will try and report.


#4

Using renderUI was a bit last-millenium. I used a simple Javascript extension with Dean Attali's shinyjs instead (https://deanattali.com/shinyjs/extend)

jsCode = "shinyjs.clearUpload = function()    $('#upload').parent().parent().next()[0].value = ''}"

Initialize in UI as

 extendShinyjs(text = jsCode)

Call in R as

js$clearUpload()