How to limit the upload image size (in MB)

If I understand what you’re saying, this might not be working as you expect. When I tried it, the input does get reset, but not before the file gets uploaded.