+ Start a Discussion

Insert attachment in Account record using Html's input type submit.

Hi All,


I am uploading a file to an external system using Html's input type submit option.Now i want to attach a file to attachments of Account detail page when my file uploaded to external system.

I am using this format to upload file to external system,


<form action="{!bucketName}" method="post" enctype="multipart/form-data" target="_target" >
<input type="hidden" name="key" id="keyvalue" /><!-- value="uploads/Tabs_limitation.png" -->
<input type="hidden" name="AWSAccessKeyId" id="AWSAccessKeyId"/>
<input type="hidden" name="policy" id="policy"/>
<input type="hidden" name="signature" id="signature"/>
<input type="hidden" id="aclid" name="acl" value="{!acl}"/>
<input type="hidden" name="Content-Type" value="application/octet-stream" />
<input type="hidden" id="success_action_redirect" name="success_action_redirect" value="https://c.na15.visual.force.com/apex/SuccessRedirect" />

<input class="btn" type="submit" value="Upload" onclick="return upload();"/>


In order to attach a file in Notes and Attachments we need Body,ContentType,ParentID,Name.Here i can retreive the file name, Parent id .But dont know how to get the Content type and Body.


Could any one please help me out to get the Body and ContentType from the above format,


Thanks in advance








Hi Raj, 

Can you elaborate a little more. It would be great if you can add a screenshot via tinyurl.com .