jquery 和 FormData 最简单图片异步上传
<script src="/scripts/jquery/jquery-3.1.1.min.js"></script> <script type="text/javascript"> $(function () { var fileInfo = $('#file').prop('files')[0]; var fm = new FormData(); fd.append("xxxx", fileInfo); $.post("url", fm, function (rs) { }, "json"); }) </script>
"唯有高屋建瓴,方可水到渠成"