首页  >  问答  >  正文

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

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

大家讲道理大家讲道理2768 天前654

全部回复(1)我来回复

  • 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>

    回复
    0
  • 取消回复