function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Posting Binary data

I want to upload a file using a pure HTML form, i.e. No Visual force but instead of gettign the file data as a Blob I just get a reference to the file as:


/home/sfdc/salesforce/sfdc/jsp/form/form1433903752.tmp   is there any API call we can use to convert that into an blob or attachment


This is my HTML


 <form id="myForm1" action="fileTest" method="POST" enctype="multipart/form-data">
       <input type="hidden" name="MAX_FILE_SIZE" value="100000" />

        File: <input type="file" name="file" />
   <input type="submit" value="Submit" />




This my apex


 public fileTest()
        Map<String, String> m = System.currentPageReference().getParameters();
        for(string key : m.keySet())
              System.debug('============= key ='+ key  + ':'+     System.currentPageReference().getParameters().get(key));

I get back the file name, file content type, but not the file binary data just a internal folder/file path such as /home/sfdc/salesforce/sfdc/jsp/form/form1433903752.tmp    is there any hooks I can use to covert that into a Blob?


Yes I do know I can use Visualforce to do this and save directly to an Attachment or Document. But I do not want to do this.



This doesn't seem straighforward, from what I've found:


But the blog entry does mention encoding the blob as a base64 and then passing as a param. then decoding in apex. that's the next step I'll try.


Let me're trying to build a multi-file uploader? :)