shinyMobile icon indicating copy to clipboard operation
shinyMobile copied to clipboard

f7File: show error message when file exceeds max size

Open Tixierae opened this issue 3 years ago • 4 comments

Hi,

f7File currently displays the name of the uploaded file even when it exceeds the max allowed size (5MB by default) making the user believe that the file was accepted whereas in reality it was not.

On the server side, it is not possible to know whether the file was too big or whether no file was uploaded at all: both cases are associated with a NULL input (see MRE below). This makes it impossible to handle the 'too big' case on the server side, e.g., by displaying a custom error message.

So, it would be nice if an error message could be displayed directly in the f7File widget.

Thanks!

library(shiny)
library(shinyMobile)

ui = f7Page(
  f7SingleLayout(
    navbar = f7Navbar(title = "File handling"),
    f7File('up', 'Upload!'),
    actionButton('test','Click me')
  )
)
server = function(input, output) {
  observeEvent(input$test,{
    print(input$up)
  })
}
shinyApp(ui, server)

Tixierae avatar Jun 30 '21 10:06 Tixierae

Hi @Tixierae, Seems that nobody can help you with your questions. I also cannot help you on this. I don't even know where to set the max allowed file size - no documentation on that? But I do have another question which you maybe can answer: I'm not a programmer but I spent the whole week 'programming' an app which has the core functionality to upload images from my phone to my Google Drive (specific folder). Turns out the f7File function is not working. There is no input$up when I select an image on the device. When I select a file (f.e. from downloaded folder) it does work. Do you have experience with that?

dannyvolkaerts avatar Apr 15 '22 20:04 dannyvolkaerts

Hi @dannyvolkaerts - in order to maximize your chances of receiving help, I encourage you to file a new issue and to create a minimal reproducible example that highlights the problem you are facing. It will be difficult for anyone to help you without seeing code and what the problem exactly is.

Tixierae avatar Apr 15 '22 20:04 Tixierae

Hi @Tixierae,

Thank you for the suggestion. I reused your MRE and changed it slightly to explain my point and filed a new issue.

dannyvolkaerts avatar Apr 15 '22 21:04 dannyvolkaerts

Hi, I have the same request. If the file exceeds max size, an alert must be shown to the user as it is done with the fileInput function. Currently, if such a file is uploaded, then input$file_upload renders as NULL.

alexquant1993 avatar Dec 24 '22 17:12 alexquant1993