Version 2

     

    Summary

    You may notice that the file size of an attachment may appear to slightly change when it is uploaded in Jive.

     

    For example, you may have a zip file on your computer that is 21.8MB, but after uploading it into Jive it will report as being 20.8MB.

     

    When you download the file from Jive back to your computer, you will see that the file returns to its previous size of 21.8MB.

     

    File in Mac OS X - 21.8MB:

     

    Screen Shot 2015-03-20 at 11.35.33 AM.png

     

    File attachment in Jive - 20.8MB:

    Screen Shot 2015-03-20 at 11.33.30 AM.png

     

    Why Does This Happen?

     

    The file itself is not changing size. There is no data loss and the contents of the file is not being manipulated.

     

    What is happening is that the way that the file size is calculated by Jive is slightly different than how your operating system, such as Windows or Mac OS X, is calculating file sizes.

     

    The cause of the difference is Jive calculating a kilobyte as 1024 bytes. Jive uses a binary method of calculating file sizes.

    Your operating system is likely calculating a kilobyte as 1000 bytes. Your operating system uses a decimal method of calculating file sizes.

     

    The files themselves are the same across both methods - Only the calculation of the file size is changing. Neither of these calculations are incorrect. They're just the difference between calculating file sizes using Decimal vs Binary. Jive uses Binary and your local computer likely uses Decimal.

     

    There is only a 2.4% difference between a decimal and a binary kilobyte, but when you calculate a megabyte, this difference increases to approximately 5%. This explains why a 21.8MB file on your computer will appear to be 20.8MB in Jive.

     

    You can read more about the differences in these calculation methods here: Binary vs. Decimal Measurements

     

    Example File Upload

     

    Here we will take an example of uploading a file into Jive and seeing how its file size is calculated.

     

    We will upload a file called "JiveForOutlookClient.zip". In OS X it is reported to be 21.8MB:

    Screen Shot 2015-03-20 at 11.35.33 AM.png

     

    We can run a command line program to see the total number of bytes for the file on the computer. It is 21763278 bytes.

    david.bastedo:Downloads$ wc -c  JiveForOutlookClient.zip

    21763278 JiveForOutlookClient.zip

     

    Screen Shot 2015-03-20 at 11.59.38 AM.png

     

    If we take 21763278 and convert it to Megabytes using the decimal method, we will see that it comes out to 21.8MB:

     

    Decimal conversion method

    21763278 / 1000 / 1000 = 21.763278 ~ 21.8

     

    If we create a new document and upload the file, we see that it is now reported to be 20.8MB (1MB less):

     

    Screen Shot 2015-03-20 at 11.33.30 AM.png

     

    If we look at the database to inspect the file contents, we can see that Jive also reports that the file size is 21763278 bytes, which matches what we saw on the computer it was uploaded from.

     

    SELECT filename, filesize FROM jivedocumentbody WHERE bodyid = 1455;

            filename        | filesize

    --------------------------+----------

    JiveForOutlookClient.zip | 21763278

    (1 row)

     

    If we take 21763278 and convert it to Megabytes using the binary method, we will see that it comes out to 20.8MB:

     

    Binary conversion method

    21763278 / 1024 / 1024 = 20.755079 ~ 20.8