Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

How to limit the upload file size

Hello everyone,
In my dash app, I want to limit the size of the file which is uploaded by users, but don’t find the way to get the size of the file before it is read. Is there a way to get the file size?

Thank you!
Best Wishes!

Hi @zxz2020

The dash-uploader (I am the author) has option for defining the max file size:

For example

du.Upload(
    id='dash-uploader',
    filetypes=None,
    max_file_size=1024, #1024 Mb
    max_files=1,
)

However, if it is an open multi-user app, you might need to consider the security aspects as well and make sure that you check the HTTP POST requests that they are coming from a user that is logged in and has needed permissions. (That I haven’t tried out myself)

1 Like