14
Views
12
Comments
[ReactFilePondUpload] [ReactFilePondUpload] Uploaded File Size Vs Local File Size
Question
reactfilepondupload
Reactive icon
Forge asset by Stuart Harris

Hi,

I've encountered an issue where the uploaded file size differs from the local file size.

This is the uploaded file size:

And this is the local file size:

Notice the message indicates 8.4 MB, but the actual file size is 8.1 MB.

How can I resolve this?

I also found a post on Pqina's GitHub discussing a similar problem, but I'm unsure where to modify the code in the Forge component to fix this.

Thank you.

2025-07-31 10-32-21
Vikram garasiya

hi, @Ronaldo David 

you can set the maximum file size in configuration property of widget 

2020-12-16 07-47-53
Ronaldo David

Hi Vikram,

We have set our Maximum File Size to 5MB but notice that the message for the uploaded file size is different with the local file size. The user might get confused why the uploaded file seems bigger vs the one in their local storage.

Thank you.

2024-11-07 03-28-42
Stuart Harris
Champion

Hi Ronaldo,

Well done for identifying this one and finding that discussion.

I could expose the FileSizeBase configuration option. However, that won't solve the problem on both Windows and Mac.

The problem is that Windows and Mac use different calculations to display the file size (mebibyte versus megabyte).

Kind regards,

Stuart

2020-12-16 07-47-53
Ronaldo David

Hi Stuart,

Thank you for your quick response. I hope we can make the FileSizeBase configuration option available. In my situation, our application is run on company-provided workstations using the Windows operating system.

Is there a quick manual solution I can apply to our Forge asset to set the FileSizeBase?

Thank you.

2024-11-07 03-28-42
Stuart Harris
Champion

Hi Ronaldo,

If you're really brave (of course you are! :) ), you could edit the filePondUploadPlugin script.

Add fileSizeBase: 1024 after line 551:


2020-12-16 07-47-53
Ronaldo David

Hi Stuart,

I have added the code inside filePondUploadPlugin but the result is still the same.

The text should be 8.1 MB. Is there another way to modify the fileSizeBase?

Thank you for your patience.

2024-11-07 03-28-42
Stuart Harris
Champion

Hi Ronaldo, I will have to investigate.

Are you using the latest version of the forge component? The latest version uses version 4.30.4, however, the previous version won't have fileSizeBase in its configuration.

Let me know if you are on the latest version, and if so I'll investigate. It might take me a week to have time to properly investigate, but I'll have a look for you.

Kind regards,

Stuart

2020-12-16 07-47-53
Ronaldo David

Hi Stuart,

I updated to latest version and it started working but the display is still different from what I expect.

  • File 1 - Local File Size: 16471 KB (16.4 MB)
  • File 2 - Local File Size: 8189 KB (8.1 MB)

Also the Maximum file size display changed to 4.8 MB which should be 5 MB.

Thank you.

2024-11-07 03-28-42
Stuart Harris
Champion

Hi Ronaldo,

Ok great. The problem is this component just integrates the library, so whatever the library does it will do.

What happens if you specify 5.12MB as the maximum file size? (5 x 1024/1000)

I hope this helps.

Kind regards,

Stuart

2020-12-16 07-47-53
Ronaldo David

Hi Stuart,

I tried setting it to 5.12 but it is still the same. I noticed that it is still 5 MB in the console log even after setting it to 5.12. Is it possible that it is rounding off to 5?

Thanks.

2024-11-07 03-28-42
Stuart Harris
Champion

Ah yes, it is removing the decimal places. If you remove the Math.floor that could work.

2020-12-16 07-47-53
Ronaldo David

Hi Stuart,

This was the result after removing the Math.Floor.


I'm not really sure why it displayed 5 bytes. (MaxFileSize is set to 5.12 MB)

Thank you.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.