js 使用jquery.form.js文件上传
2017-02-15 22:47 muamaker 阅读(1439) 评论(0) 编辑 收藏 举报1.文件上传,使用jquery.form.js插件库
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.form.js"></script> </head> <body> <form id="form1" action="http://fapi.eg365.cn/api/Public/feedbackupFile?token=a04f3115eff8a0c106e419524a57c8e1&login_time=1487166690&loginuid=50" method="post" enctype="multipart/form-data"> <input type="file" name="files" id="file" /> </form> </body> <script type="text/javascript"> var options = { success: function (data) { console.log(data) } }; $("#form1").ajaxForm(options); $("#file").on("change",function(){ console.log(this.files) $("#form1").submit(); }) </script> </html>