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
VintaraVintara 

Detecting when an uploaded exceeds maximum attachment size?

The limit in size for an attachment is 5MB, however when using an apex:inputFile controller the result of attempting to upload a file larger then that is a null object. Is there a way to detect when the file atempting to upload is larger then the limit?

Pradeep_NavatarPradeep_Navatar

To avoid maximum view state error you can use transient keyword as a prefix with your properties to which you have assigned in <apex:inputfile>

VintaraVintara

I'm not having issues with the view state. The problem I'm trying to detect is when a file larger then the maximum excepted attachment size is selected. The file just gets nulled in apex when that happens and I cant tell the difference between a file thats too large and no file at all.

Sure@DreamSure@Dream
Hi Vintara,

Are you able to find any solution for this?

Thanks