Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Inaccurate file size calculations in Dropzone #3010

Open
monteri opened this issue Feb 23, 2024 · 1 comment
Open

[bug] Inaccurate file size calculations in Dropzone #3010

monteri opened this issue Feb 23, 2024 · 1 comment
Labels
bug Report of or fix for something that isn't working as intended

Comments

@monteri
Copy link
Contributor

monteri commented Feb 23, 2024

I encountered a bug when used maxSize prop on the Dropzone component. I passed 20 * 1024 * 1024 that equals to 20MB. When I uploaded a file of size 20.3MB the error state didn't occurred. I investigated deeper and found out that 20 * 1024 * 1024 = 20971520 that is bigger than 20312736 (the file size). image

In that time the component displays the error correctly when I pass a file of 80MB. It says that File must be less than 20MB..

As a work around I passed 20 * 1000 * 1000 and obtained the desired behavior of the error state but the alert displays inaccurate value of 19.07MB.

image
@monteri monteri added the bug Report of or fix for something that isn't working as intended label Feb 23, 2024
@monteri monteri changed the title [bug]: Inaccurate file size calculations in Dropzone [bug] Inaccurate file size calculations in Dropzone Feb 23, 2024
@brian-smith-tcril
Copy link
Contributor

It seems like on your local machine filesizes are calculated using decimal instead of binary

image

Where as react-dropzone and the utils to format byes in a user friendly format use binary instead of decimal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of or fix for something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

2 participants