search

Home  >  Q&A  >  body text

javascript - ajaxFileUpload 插件如何在前台限制图片上传大小

ajaxFileUpload 插件如何在前台限制图片上传大小

大家讲道理大家讲道理2793 days ago678

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-11 09:12:46

    
    <script type="text/javascript">
    function UploadCompleteClient(sender, args) {
      var filesize = args.get_fileSize();
      var fileId = args.get_fileId();
    
    
      var status = document.getElementById('AjaxFileUpload1_FileItemStatus_' + fileId);
    
      if (parseInt(filesize) > fileSizeLimit) {
    
        alert("file exceeds file size limit");
        if (status.innerText) {
          status.innerText = " file exceeds file size limit ";
        }
        if (status.textContent) {
          status.textContent = " file exceeds file size limit ";
        }
      }
    }
    </script>

    reply
    0
  • Cancelreply