input file 图片上传

使用第三方:
jquery.ajaxfileupload.js

input中的name根据后端来定
<form method="post" enctype="multipart/form-data">
     <a href="javascript:void(0);" class="file">图片上传
         <input type="file" name="imgFile" id="pic" value="图片上传">
     </a>
     <!--缩略图显示-->
     <div id="thumbnail"></div>
</form>
$(function () {
    $('#pic').AjaxFileUpload({
        action: imgUpload,
        onComplete: function (filename, response) {
            console.log(response);
        }
    });
});

原文地址:https://www.cnblogs.com/91allan/p/6207090.html