Did you check the below article?
It has the implementation to restrict specific file type with 2 Mb limit.
Here is another approach with filter to restrict. You can apply for specific file type as well.
Let us know if you are looking for something else.
hi @Asutosh_Jena_ the first article is working fine in classic UI .
but its not working in touch UI .
i am using aem cloud