You need to sign in to do that
Don't have an account?
![dke01 dke01](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
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" /> </form>
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:
http://boards.developerforce.com/t5/Apex-Code-Development/Posting-in-binary-data/td-p/127004
http://blogs.developerforce.com/developer-relations/2011/09/using-binary-data-with-rest.html
http://boards.developerforce.com/t5/forums/forumtopicprintpage/board-id/apex/message-id/53478/print-single-message/false/page/1
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 guess....you're trying to build a multi-file uploader? :)