input file 上传文件后显示出来
2016-07-06 10:02
197 查看
<!DOCTYPE html> <html lang="en"> <head> <title></title> <script src="js/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#btnGetFile").click(function (e) { var fileList = document.getElementById("fileDemo").files; for (var i = 0; i < fileList.length; i++) { if (!(/image\/\w+/.test(fileList[i].type))) { $("#result").append("<span>type:"+fileList[i].type+"--******非图片类型*****--name:"+fileList[i].name+"--size:"+fileList[i].size+"</span><br />"); } else { $("#result").append("<span>type:"+fileList[i].type+"--name:"+fileList[i].name+"--size:"+fileList[i].size+"</span><br />"); } } }); }); </script> </head> <body> <form action="/home/index" method="POST" novalidate="true"> <input type="file" multiple="multiple" name="fileDemo" id="fileDemo" /><br/> <input type="button" value="获取文件的名字" id="btnGetFile"/> <div id="result"></div> </form> <hr/> </body> </html>
相关文章推荐
- python多进程与多线程之间的联系
- poj1472[模拟题]
- WPF实现Twitter按钮效果(转)
- 安装myeclipse之前jdk的安装及配置(附:jre)
- LinuxMint 18 编译cm 笔记
- 在C/C++中的inline介绍和用法
- 深入分析JavaWeb servletConfig 与servletContext
- 绑定hosts
- 模仿36。杀毒~button(转)
- 开源公司黄页之 Twitter 开源软件推荐
- java实现Huffman树
- 服务多次调用的的话 如何优化
- 【poj】1128 Frame Stacking【拓扑排序+输出字典序】
- RxJava 驯服数据流之高级错误处理
- Tomcat、Weblogic、Jboss、WebSphere之间的区别和联系
- 在vSphere Client上安装虚拟机工具VMware Tools
- 李洪强经典面试题26(选择题)
- Java8新特性之一、时间日期API
- linux环境搭建ftp服务以及遇到的问题总结:上传不成功,ftp:connection refused等等
- Spring Boot学习总结(2)——Spring Boot整合Jsp