You need to sign in to do that
Don't have an account?

Apex max heap size limits size of attachment one can upload via a VF page
I'm building a Visualforce page that uses the inputFile component to create an attachment.
All works fine. However, the heap size limit prevents me from being able to upload an attachment larger than 3MB, even though Salesforce itself allows attachments of up to 5MB.
Any suggestions on how I might overcome this obstacle?
Turns out the issue had to do with how I was creating my Attachment object.
Originally I was initializing the fields within the constructor (which is how I typically create an SObject). Switching to the default constructor (i.e. no parameters) and setting the field values after solved the problem (???).
Salesforce has acknowledged that there should be no difference between the two and that this is a bug. I have not heard anything further as to whether the issue has been resolved.