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
Leno, Elite SysAdminLeno, Elite SysAdmin 

Can I upload document > 6MB via apex?

I am a system admin and do not understand much about apex coding. Would like to clarify if it is an apex limitation that disallow uploading of document more than 6MB?

The VF page coding as below.
<apex:tab label="2. Upload File" name="step2" id="tabTwo" styleClass="upload-content" disabled="{!IF(ValidToken == false, true, (IF(gc.size == 0, false, true)))}">
                        <div class="standard-padding">
                            <apex:form id="form-upload">
                                <apex:pageBlock >
                                    <div class="action-container">
                                        <apex:actionFunction name="ChangeCount_JS" action="{!ChangeCount}"/>
                                        <apex:pageblocksection >
                                            <apex:pageBlockSectionItem >
                                                <apex:outputLabel value="How many files you want to upload?"/>
                                                <apex:selectList onchange="ChangeCount_JS() ;" multiselect="false" size="1" value="{!FileCount}">
                                                    <apex:selectOption itemLabel="--None--" itemValue=""/>
                                                    <apex:selectOptions value="{!filesCountList}"/>
                                                </apex:selectList>
                                            </apex:pageBlockSectionItem>
                                            
                                        </apex:pageblocksection>
                                        
                                        <apex:pageBlockSection title="Select Files (5mb per file max)" rendered="{!IF(FileCount != null && FileCount != '', true , false)}">
                                            <apex:repeat value="{!allFileList}" var="AFL">
                                                <apex:inputfile value="{!AFL.Body}" filename="{!AFL.Name}" contentType="{!AFL.ContentType}"/>
                                                <br/>
                                            </apex:repeat>
                                        </apex:pageBlockSection>
                                            
                                        <br/>
                                        <br/>
                                        <br/>
                                        <br/>
                                        <center>
                                            <apex:commandButton styleClass="submit" onclick="this.value = 'Uploading...'" value="Upload file" action="{!UploadFile}" />
                                        </center>
                                        <br/>
                                        <br/>
                        
                                        <br/>
                                    </div>
                                </apex:pageBlock> 
                            </apex:form>
                        </div>

 
Best Answer chosen by Leno, Elite SysAdmin
Khan AnasKhan Anas (Salesforce Developers) 
Hi Leno,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/7800/loading-files-greater-than-5m-using-vf-page

https://salesforce.stackexchange.com/questions/70483/file-attachment-upload-maximum-view-state-size-limit-135kbexceeded

https://kevansfdc.blogspot.com/2017/05/upload-attachment-to-salesforce-without.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Leno,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/7800/loading-files-greater-than-5m-using-vf-page

https://salesforce.stackexchange.com/questions/70483/file-attachment-upload-maximum-view-state-size-limit-135kbexceeded

https://kevansfdc.blogspot.com/2017/05/upload-attachment-to-salesforce-without.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Leno, Elite SysAdminLeno, Elite SysAdmin
Thanks Anas. I will share this information with my developer.