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

  • Naman

    Member
    April 25, 2016 at 7:08 am

    Page :

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

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

    class:

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

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

    pg = new PageReference(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/ViewApplicationsRecord?guid='+appRecord.id);
    pg.setRedirect(true);
    return pg;
    }

    appRecord.id is the id get from URL.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos