JSFiddle - React, Tailwind, and code Playground

by shahrukh007

HTML

<html>
<body>
 <input type="file" id="fileUpload" accept="image/*"/>
 <button type='button' onclick='uploadFunction(event)'>Upload</button>
    <script>
     function uploadFunction(e){
      var fileUpload = $("#fileUpload")[0];
      var reader = new FileReader();
      reader.readAsDataURL(fileUpload.files[0]);
      var image = new Image();
      image.src = e.target.result;
      var height = image.height;
      var width = image.width;
      if (width > 600) {
      alert("Width not exceed 600px.");
      }
      if (width < 600) {
      alert("Width not less than 600px.");
      } 
      if (width == 600) {
      alert("correct image.");
      }
      
      }
</script>
</body>
</html>