3

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?

2
  • What exactly do you want to do here? Are you asking if you can store both files in the same document? I don't think that's going to work since they're different formats, but an archive (like a zip) might do the trick. I'm reasonably sure the document body will be base64 encoded but definitely not 100%.
    – Matt Lacey
    Commented Mar 17, 2014 at 10:27
  • 1
    Acctually I want to know that if I upload two files into Attachment object under mycustom object. First file is txt type and another file is pdf type then my file is store in attachment body in binary or base64. And I want to know that blob is binary or base64 type
    – D-Horse
    Commented Mar 17, 2014 at 10:31

1 Answer 1

3
  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.
2
  • thanks for your response, 1) I got it your point that the file is upload by user is transmitted in the form of binary. 2) According to your second point, we can't get the size of file which is reported by Blob class based on binrary form or base64.
    – D-Horse
    Commented Mar 17, 2014 at 10:41
  • 1
    The size of the data that you saw on your local computer is the size that the Blob will report. If you want to know the size of the data in some specific encoding, then you will have to do that encoding and then check the size.
    – Keith C
    Commented Mar 17, 2014 at 10:44

You must log in to answer this question.

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