Hi @alptaciroglu. As you wanna disable the button during upload, first of all, I have to point out that the fileInput job is when you select the file in the client side, the file will upload to the the temp file of server side. And the input will provide the address of the uploaded temp file. That mean the upload file data still not in the R environment and you need to import the file data from the temp file. So, you can still do anything during uploading and will not affect or be affecting by the uploading process.
But never mind, if you want to disable the button during uploading data to the temp file, it is a little bit tricky and didn't know if any harm to the remaining script. You need to use javascript to make disableButton function. And add onchange attribute to trigger the disableButton function when the input file address is changed.
library(shiny)
library(shinyjs)
options(shiny.maxRequestSize = 1000*1024^2)
ui <- fluidPage(
tags$script("function disableButton() {
document.getElementById('ActionButton').disabled = true;
}"),
titlePanel("Disable Action Button while File is uploading"),
fileInput(
inputId = "MyFiles",
label = "Upload files"
) %>%
{temp = .
temp$children[[2]]$children[[1]]$children[[1]]$children[[2]]$attribs$onchange <- "disableButton()"
temp},
mainPanel(
shinyjs::useShinyjs(),
actionButton("ActionButton","Go")
)
)
server <- function(input, output) {
observeEvent(input$MyFiles$datapath,
{
enable("ActionButton")
})
}
shinyApp(ui = ui, server = server)