Sriram Murali Sriram Murali - 1 year ago 96
R Question

Re-upload same file shiny R

I am following the simple file upload example from shiny gallery, but with a slight modification. I am required to modify the csv files locally, and see the changes reflected on the UI. However, I believe that this is not possible unless we poll for any changes in the source.

Therefore, I simplify the problem, by allowing re-uploading of the file. But, this is also not happening in Shiny. Once a file "file1.csv" is uploaded, i cannot upload the same file again. I have to upload a different file "file2.csv" and then once again the original file "file1.csv".

This is just time consuming, and I am wondering if anyone has come across such an issue, and possibly found a solution for it.

Answer Source

Adding a jquery to clear the value of the fileInput does the trick.

fileInput("csvInput", "Upload CSV file", multiple = TRUE,
tags$script('$( "#csvInput" ).on( "click", function() { this.value = null; });'),
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download