Using trigger we can impose attachment Size in Salesforce before attaching it. Check the following trigger for reference.
Sample Trigger:
trigger AttachmentBIUTrigger on Attachment (before insert, before update) {
for(Attachment att : trigger.new) {
if(att.Body.size() > 3145728) {
att.addError(‘Size cannot be greater than 3 MB’);
}
}
}