Validation Minimum file size for attachment

Is there any way(any spring property) to control the minimum size for attachment in task forms? For example if the attachment is a blank page, then validation error should trigger on the form.
If there is no out of box property, how can we prevent from attaching blank attachment files?

Validate attachment after the task complete.

Regards
Martin

What I am looking for is if we can throw some validation error while attaching the blank file itself rather than allowing user to complete task with empty attachment document. Is there any listener available for content items?

@AlexTheBeginner , if you do as per @martin.grofcik mentioned, and throw exception, task won’t complete, and user will see error directly on screen.