Attachment Files in doctypes

Good afternoon, I have a doubt, how can I restrict the number of files that can be attached in the doctype and the weight of the file