在项目中用到了uploadify来上传jar包文件,在其官网上只有php和ASP的实例。在网上找了很多,都不是很满意,下面就共享一下基于项目做的一个多文件上传:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>插件上传</title> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/jquery.easyui.min.js"></script> <script type="text/javascript" src="js/swfobject.js"></script> <script type="text/javascript" src="<%=basePath%>js/jquery.uploadify.v2.1.0.min.js"></script> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <link rel="stylesheet" href="style/default.css" type="text/css"></link> <link rel="stylesheet" href="style/uploadify.css" type="text/css"></link> <link rel="stylesheet" type="text/css" href="style/easyui.css"> <script type="text/javascript"> $(document).ready(function() { var maxBytes = 1024 * 10 * 1024;//设置上传最大值10MB $("#jar").uploadify({ 'uploader' : 'js/uploadify.swf', // 上传文件的swf 'script' : '****.action',//传到后台处理 'cancelImg' : 'style/images/cancel.png', 'folder' : 'temp',//这个没啥用 'fileDataName' : 'jar',//这个和下面的 浏览按钮的name保持一致 'queueID' : 'fileQueue', 'fileDesc' : 'All Files Jar', //这个是浏览框显示的字 'sizeLimit' :maxBytes,//最大字节限制 'queueSizeLimit' : 5,//这个是一次最多能上传几个文件 'fileExt' : '*.jar',//限制类型 'auto' : false, 'multi' : true, 'displayData' : 'percentage',显示百分比 'buttonText' : '浏览', 'onComplete' : function(event,queueID,fileObj,response,data) {//完成的函数 return false; }, 'onError':function(event, ID, fileObj, errorObj){//出错的提示信息 if(maxBytes < fileObj.size){ $.messager.alert('提示','['+fileObj.name+']太大,超过了最大限制,最大限制为 10MB ','info'); return false; } return true; }, 'onQueueFull':function(event,queueSizeLimit){//一次上传到达上限之后提示 $.messager.alert('提示','一次最多只能上传 [' + queueSizeLimit + '] 个jar 包','info'); return false; } }); }); </script> </head> <body> <div id="fileQueue"></div> <input type="file" name="jar" id="jar" /> <a class="easyui-linkbutton" href="javascript:$('#jar').uploadifyUpload();" >开始上传</a> <a class="easyui-linkbutton" href="javascript:$('#jar').uploadifyClearQueue();" >取消上传队列</a> <br> <br> </body> </html>
对于官网发布的这个uploadify.swf在上传测试时发现,清空队列,和删除上传的文件只能在上传前有效,
在上传完成后在点击清空上传队列或者删除已上传的队列,则会报错,这还是需要改进的地方;不知道其他人有没有这个问题
相关推荐
struts1 uploadify 多文件上传
struts2 +jquey uploadify3 2 实现多文件上传 可以运行的myeclipse工程 绝对好用 访问方式http: 127 0 0 1:8080 Struts2Uploadify upload jsp uploadify 使用说明: <a href "javascript:$ "#file ...
利用struts2框架实现uploadidfy多文件上传,显示进度条上传
struts2 + uploadify上传文件示例
使用struts2和uploadify(2.1.4)开发的文件上传插件
代码使用Struts2框架和uploadify插架实现多文件上传功能。
这是根据uploadify3 2结合struts2搭建的文件上传环境 可以直接导入eclipse运行 每步实现基本都加了注释 以下是我碰到的问题: 1 判断session是否失效 本实例没测试这个问题 但在工作项目中碰到了 但原因在这里...
程序进过本人亲测,附件中含SQL,用的是MySQL数据库,实现了带进度条的多文件上传,并提供下载功能,解压后可直接导入Eclipse,希望对你有所帮助。
uploadify+struts2多文件上传实例,解决了在firefox下的session问题,相信能帮助到你的
struts2 +jquey uploadify3.2 实现多文件上传,可预览、删除、排序 http://blog.csdn.net/ht99582/article/details/9190701
struts2结合uploadify3.2实现上传进度条,可控文件大小
这是本人写的一个基于uploadify-3.2.1插件上传图片(文件)的Web项目,采用Struts2框架,实现了多图片(文件)上传,并可显示上传进度,不会刷新当前页面,上传成功后,立即显示所上传的图片(文件)。下载解压后...
'fileDataName' : 'file' 因为在页面上没有加上这个属性,导致在aciton里边接收不到file文件,页面会显示:HTTP ERROR! /index.jsp return "upload"; 开始我这里没有返回值,直接return null,以为它是ajax...
主要为大家详细介绍了Struts2+uploadify多文件上传实例,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
在IE浏览器可以正常运行,点击开始上传下面的白色区域,进行上传
Uploadify + Struts2 实现文件上传详解 有需要的看看
uploadify是来自国外的一款优秀的jQuery上传插件,主要功能是批量上传文件,带进度显示。
struts2 uploadity
jquery xheditor是jquery中较好的编辑器插件,而jquery.uploadify也是jquery实现文件上传很优秀的插件,本项目实例解决了两个插件文件上传的问题,对于应用学习两个插件,实现文件上传,具有很好的参考价值,同时本例子是...
NULL 博文链接:https://winder-sety.iteye.com/blog/2073444