<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>文件上传</title>
<link href="styles/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.uploadify-3.1.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : '<%=path %>/module/upload/uploadify.swf',
'script' : 'uplaodAction!doUpload.action',//后台处理的请求
'cancelImg' : '<%=path %>/images/uploadify-cancel.png',
'folder' : 'uploads',//您想将文件保存到的路径
'queueID' : 'fileQueue',//与下面的id对应
'queueSizeLimit' :1,
'fileExt' : '*.rar;*.zip', //控制可上传文件的扩展名,启用本项时需同时声明fileDesc
'fileDesc' : 'rar文件或zip文件',
'auto' : false,
'multi' : true,
'simUploadLimit' : 2,
'sizeLimit' : 100 * 1024 *1024,
'buttonText' : '上传'
});
});
</script>
<body>
<form action="uplaodAction!doUpload.action" method="post" enctype="multipart/form-data">
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p>
<a href="javascript:$('#uploadify').uploadifyUpload()">开始上传</a>
<a href="javascript:$('#uploadify').uploadifyClearQueue()">取消上传</a>
</p>
</form>
</body>
</html>
<a href="javascript:$('#uploadify').uploadifyUpload()" >开始上传</a>
45 <a href="javascript:$('#uploadify').uploadifyClearQueue()">取消上传</a>
46 </p>
看下官网用法》
<p><a href="javascript:$('#file_upload').uploadify('upload','*')">上传图片</a>
<a href="javascript:$('#file_upload').uploadify('cancel')">取消上传</a>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。