function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SalesforceDF2011SalesforceDF2011 

Adding Attachments thru Force.com Sites

Hi,
I am using the standard SFDC attachment on a force.com site, but get error when uploading a large file, could you confirm whats the size of the attachment that can be attached using the sites page. Also is there a way to attach multiple files.

VF Page:

<apex:pageBlockSectionItem >
                <apex:outputText value="Upload your Attachment"/>
                <apex:inputFile accept="doc,txt,pdf" filename="{!fileName}" contentType="{!contentType}" size="28" value="{!Attach}"/>
            </apex:pageBlockSectionItem>
Controller:
public PageReference save(){
        if(recIdLst.size()>0 && attach != null){
            try{
                arg.recordTypeId=recIdLst.get(0).id;
                insert arg;
                Attachment att = new Attachment();
                att.Body = attach;
                att.Name = fileName;
                att.ContentType = contentType;
                att.ParentId = arg.id;
                insert(att);
                return new pageReference('/apex/Complete');
            }catch(System.DMLException e){
                   ApexPages.addMessages(e);
            } 
Thanks!
Ispita_NavatarIspita_Navatar

Hi,

           Maximum attachment size to upload an attachment is 10 MB if you upload the document more than this, encounters

           salesforce generated error somthing like Maximum view state size error.You can handle this by custom error message,in order to override the salesforce generated error message.                           

 

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