+ Start a Discussion

How to attach a file in an OBJECT

Hi, Actually I am maintaing employees in one object and my requirement is 'his resume needs to be uploaded individually' How can I achieve this.... Any help will be appreciated Thanks Kiran



You can create a vf page for uploading the resume.


Try the below code snippet as reference:




<apex:page controller="UploadDoc">


  <apex:sectionHeader title="Upload a Document into Salesforce"/>


      <apex:pageblocksection columns="1">

          <apex:inputfile value="{!myimage.body}" filename="{!myimage.Name}" />

          <apex:commandbutton value="Save" action="{!Savedoc}"/>









public class UploadDoc


Public Document mydoc;

    Public Document getmyimage()


        mydoc = new Document();

        return mydoc;



    Public Pagereference Savedoc()


        mydoc.folderid = UserInfo.getUserId(); // Stores in the currennt users "My Personal Documents" folder

        //mydoc.folderid = 'any other id you want here'; // Fetch Id dynamically by using [Select Id from Folder where Name='My Images']. Specifying a FolderId is mandatory

        insert mydoc;

        return NULL;






Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.