While allowing users to upload files then there may be a case arrives where you have to restrict image width and height before upload.
This is very common in Job Application Forms where the user can only upload its profile photo of given dimensions other it’s not uploaded.
In this tutorial, I explain with an example how you can implement it. For uploading, I am using AJAX and PHP and done restrictions with JavaScript.