[SalesForce] Blob store the data in binary form or in base64

1) When we upload a file into the document object then is the body of the document in binary form or in base64 form?

2) If I uploaded two files in document, First is abc.txt and second is xyz.pdf then does the body of document store both files in same structure?

Please can someone clarify these points for me?

Best Answer

  1. File upload between a browser and a HTTP server encodes the data using "multipart/form-data" encoding (see e.g. http://www.rfc-editor.org/rfc/rfc1867.txt) and this allows the form fields and the file data being uploaded to be sent in one message. Unlike email protocols, HTTP supports the transmission of binary data, and the content of the file is transmitted in its raw binary form.
  2. Salesforce may or may not do different things with different types or sizes of uploaded files. The only interface we are provided with is the methods of the Blob class so we cannot tell. (The size that the Blob class reports is the size of the original data.) Salesforce do count the space used as "File Storage" rather than "Data Storage" though.
Related Topic