The attachment file size limitation on Salesforce platform is 25 MB (as of 29/Aug/2017).

When the attachment file size is over 25MB, the system will remove the attachment automatically without any signal, so we can’t catch the exception when user submitting a file with size over 25MB, which causing confusion to end user.

There are 2 ways to validate a file size:

  1. Server-side validation by using Apex code
  2. Client-side validation by using JavaScript and HTML5

Server-side is certainly useless in this situation, since when the attachment file size is over 25MB, it will be cleared by system, without any signal, therefore no chance to validate the size.    [ref. https://salesforce.stackexchange.com/questions/24969/large-size-attachment-upload-auto-removed-by-salesforce-is-it-a-bug]

Think about the only available option: Client-side validation

JavaScript + HTML5

Now, hope all browsers support HTML5.


Leave a Reply

Your email address will not be published. Required fields are marked *