jq监听input type="file"发生改变,即选择文件

 $("#img_file").change(function() {
            jQuery.ajaxFileUpload({
                   
                 console.log(888)
        })
<input type="file" name="file" id="img_file">

不需要点击上传文件按钮,直接判断type="file"是否发生改变,即是否选择了图片,当发生改变时,直接调用后台上传图片接口

原文地址:https://www.cnblogs.com/wangyuxue/p/13448027.html