I follow the suggestion from Find size of file behind do开发者_JS百科wnload link with jQuery for the file size checking and added return false; to prevent form submission, but failed. The code as following:
 function findSize() {
  var fileInput = $("#loadfile")[0];
  if (fileInput.files[0].fileSize > 1048 ) {
    alert(fileInput.files[0].fileSize);
    return false;
  }
 }
<input type="submit" value="Submit" class="form-submit" onclick="findSize()" />
How do I prevent form submission when file size over limit?
putting you check in the onsubmit of the form instead of the onclick of the submit-button should solve this.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论