Activity Forums Salesforce® Discussions How to upload an attachment in Form?

  • Naman

    April 25, 2016 at 7:08 am

    Page :

    <apex:inputFile value="{!attachBody}" filename="{!}"></apex:inputFile>

    <apex:button value="Save" action="{!saveProfitandLossStatement}" />


    public Attachment attach{get;set;}
    public transient blob attachBody{get;set;}

    public PageReference saveProfitandLossStatement(){ //to add more payers..
    PageReference pg=null;
    attach.parentId =;
    attach.body = attachBody;
    insert attach;

    pg = new PageReference(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/ViewApplicationsRecord?guid=';
    return pg;
    } is the id get from URL.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos