jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
来源:互联网 发布:挂历制作软件 编辑:程序博客网 时间:2024/05/01 16:34
以前用的是版本2.1.4,这次看见更新后就尝试了一下,发现有很多改变。
首先引入 js 和 css
- <link rel="stylesheet" href="uploadify.css" />
- <script src="jquery.uploadify.js"></script>
- 当然jquery 是必不可少的
接下来是代码:
- //文件上传
- $(function() {
- $("#uploadify").uploadify({
- 'auto' : false,
- 'method' : "post",
- 'height' : '20',
- 'width' : '100',
- 'swf' : 'uploadify.swf',
- 'uploader' : '<%=basePath%>/contract/fileUpload.action',
- 'fileTypeDesc' : '格式:txt,xls,xlsx,doc,docx', //描述
- 'fileTypeExts' : '*.txt;*.xls;*.xlsx;*.doc;*.docx;*.zip', //文件类型
- 'fileSizeLimit' : '10000KB', //文件大小
- 'buttonText' : '选择文件', //按钮名称
- 'fileObjName' :'uploadify',
- 'successTimeout' : '5',
- 'requeueErrors' : false,
- 'removeTimeout' : '1',
- 'removeCompleted' : true,
- 'onUploadSuccess' : function(file, data, response){
- var attach = eval('(' + data + ')');
- $("#fileTable").show();
- var addHtml = "<tr>"+
- "<td class='t_l'>"+
- "<a href='<%=basePath%>/attach/downloadAttach.action?attachId="+attach.id+"'>"+attach.filename+"."+attach.fileextname+"</a>"+
- "</td>"+
- "<td class='t_r'>"+attach.filesize+"</td>"+
- "<td class='t_c'>"+attach.uploaddate+"</td>"+
- "<td class='t_c'><a href='<%=basePath%>/attach/downloadAttach.action?attachId="+attach.id+"' id='"+attach.id+"'>下载</a></td>"+
- "<td class='t_c'><a href='#' onclick='removeFile(this)' id='"+attach.id+"' name='attach_id'>取消</a></td>"+
- "</tr>";
- $("#fileBody").append(addHtml);
- }
- });
- });
其中 onUploadSuccess为成功上传后的回调函数 file 为上传的文件,可通过file.name 获取文件名 size 可获取大小
data 为后台reponse输出的字符串,上例中输出的是 json 对象,故使用eval 进行转换
response 为 结果 true or false,具体可参考官方文档。
- <td colspan="3">
- <input type="file" name="uploadify" id="uploadify" />
- <input type="button" value="上传" onclick="$('#uploadify').uploadify('upload','*');">
- <input type="button" value="取消" onclick="$('#uploadify').uploadify('stop');">
- <table style="display: none;" id="fileTable">
- <tbody style="width: 550px;border: solid;border-color: #D0D0D3;" id="fileBody">
- <tr style="border: solid;border: #D0D0D3;">
- <td width="200px;" class="t_c">文件名</td>
- <td width="100px;" class="t_c">大小(k)</td>
- <td width="150px;" class="t_c">上传时间</td>
- <td width="100px;" class="t_c" colspan="2">操作</td>
- </tr>
- </tbody>
- </table>
- </td>
可以看到初始化中的很多属性都变化了,还包括上传操作的函数名称等等。
其次,还有一个问题,该控件在IE9中 上传文件的按钮会无法点击,初步查看可能是由于flash 的问题 引起,百度后发现 修改源码js 中的 classid即可。
具体可参考:
http://www.cnblogs.com/donhwa/archive/2011/06/23/ie9_swfupload_bug.html
解决此问题后的js替换文件下载
http://files.cnblogs.com/lostboy/jquery.uploadify3.1.fixed.js
或
http://download.csdn.net/detail/chenxiang199055/6003627
0 0
- jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
- jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
- jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
- jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
- jquery.uploadify.3.2 试用(同时解决IE9 IE10 按钮无法点击的问题)
- uploadify在ie9下点击按钮后,不弹出浏览文件对话框的问题?
- uploadify在ie9下点击按钮后,不弹出浏览文件对话框的问题?
- IE9 IE10 无法上传文件 解决方案
- uploadify点击按钮上传文件
- SWFupload在IE9中选择文件按钮无法点击bug解决方法
- Jquery中uploadify上传文件
- uploadify上传组件点击uploadify.swf,无法弹出文件选择框的原因及解决方法
- swfupload在IE9中不显示上传按钮的问题
- IE9下uploadify在模态窗口里无法弹出选择文件窗口的问题
- jquery uploadify 上传文件在firefox失败的原因
- 在SSH的基础上使用jquery.uploadify.js上传文件
- jquery文件上传插件uploadify在.NET中session丢失的解决方案
- Editor在ie9下按钮功能无效无法上传图片
- JAVA三大框架SSH和MVC
- 常用函数--不同时间粒度循环取数之Sp_Utl_PrepareData
- Android首次进入应用时加载引导界面
- 想知道spring事务管理和任务调度的详细配置吗?
- Activity四种启动模式
- jquery.uploadify.3.2.1 试用在IE9,IE10中 上传文件的按钮会无法点击
- css一些有效特性
- hibernate带连接池配置参数的 hibernate.cfg.xml配置文件
- 什么是影响日活/月活的因素?先天决定论vs.后天培养论
- 一次read()系统调用在内核中的处理过程
- Hadoop启动报Error: JAVA_HOME is not set and could not be found解决办法
- SeekBar样式
- Adapter的优化和事列代码
- git下载和上传代码