1

Max file size in 4500000 bytes which is almost equal to 4.3Mb not 4.5 Mb

I see many blog wrote as 4.5 Mb

Using input type file is not allowing to save 4.5 MB but it is allowing upto 4.3 MB

Is my understating correct? Open for suggestions

1
  • 3
    4,500,000 bytes is simultaneously 4.5 MB ("Megabytes" which defines 1 kB as 1000 bytes) and 4.292 MiB ("Mebibytes", i.e. "Mega Binary Bytes" which defines 1 kiB as 1024 bytes). It's just a difference in what you use to divide the number of bytes by to go up to the next larger SI prefix.
    – Derek F
    Apr 22, 2022 at 14:52

1 Answer 1

1

In early computing history, storage units were measured in a log2 system (e.g. "kilobyte" was defined as 210), but borrowed SI (International System of Units) prefixes, which are a log10 system (e.g. "kilometer" is 103 meters). To try and clear up the confusion for SI users, the SI introduced a new set of prefixes for the log2 system used by some computer manufacturers, and thus kilobyte became kibibyte (KiB), megabyte became mebibyte (MiB), and so on. The original names, such as kilobyte, were now defined as log10 units; kilobyte was redefined from 210 to 103.

However, Microsoft, and some other organizations, decided to use its decades-old definitions of KB instead of KiB to try and avoid confusion for their users. These days, we have RAM manufacturers that use log2 measurements for memory (e.g. a 1GB RAM stick is 230 bytes of memory), while hard drive manufacturers adopted the SI units (e.g. a 1TB hard drive is 1012 bytes), which is doubly confusing, since hard drives still use log2-sized storage units (called "sectors"), typically either 512- or 4096-byte sized units. In other words, decades of confusion have resulted from the schism between SI and computer scientists...

All that history out of the way, Salesforce has chosen to adopt the SI units. Every reference to storage or bandwidth limitations are in the standard SI unit definitions. Heap limit is 6,000,000 bytes/6MB for synchronous Apex. SOAP API has a 50,000,000 byte/50MB payload limit. The 4.5MB limit actually comes from the 6MB payload limit due to Base64 encoding (this increases the payload size by a ratio of 3:4).

Just keep in mind that the Salesforce documentation works exclusively in SI units. Whenever you see a measurement in KB, MB, GB, etc, in Salesforce documentation, it always refers to SI units. There are some obvious exceptions, such as the maximum long text area limit of 128KiB, and the maximum text/text area length of 255 bytes, and so on, but these are never referenced by their SI unit names, just the actual literal value (e.g. 131,072 characters).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .