Where is updateFileInput?

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

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

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

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()
3 Likes