Make conditionalPanel depend on files uploaded with fileInput

You have to make a reactive output returning the status of the uploading and set the option suspendWhenHidden of this output to FALSE.

More precisely, in server.R you surely have a reactive function, say getData() to make a dataframe from the uploaded file. Then do this:

  getData <- reactive({
    if(is.null(input$files)) return(NULL)
    ......
  })
  output$fileUploaded <- reactive({
    return(!is.null(getData()))
  })
  outputOptions(output, 'fileUploaded', suspendWhenHidden=FALSE)

And in ui.R you can use conditionalPanel() by doing:

conditionalPanel("output.fileUploaded",
   ......

Leave a Comment