)解压jqueryuploadifyvzip复制example\indexphp的代码对应粘贴到你的页面(HTML或ASPX)注意拷贝相应的CSSJS和SWF文件到你的项目对应目录
)解压 JQuery EasyUIzip拷贝相应的CSSJS文件到你的项目对应目录并在你的页面中的<title></title>标签中添加引用
HTML
<!DOCTYPE html PUBLIC //WC//DTD XHTML Transitional//EN transitionaldtd>
<html xmlns=>
<head>
<meta httpequiv=ContentType content=text/html; charset=utf />
<title>多文件上传 可设置多文件还是单文件上传以及上传文件的大小</title>
<!JQuery>
<script type=text/javascript src=scripts/jqueryminjs></script>
<!JQuery EasyUI>
<link rel=stylesheet type=text/css />
<link rel=stylesheet type=text/css />
<script type=text/javascript src=scripts/jqueryeasyuiminjs></script>
<!MultiUpload>
<link rel=stylesheet type=text/css />
<link rel=stylesheet type=text/css />
<script type=text/javascript src=scripts/swfobjectjs></script>
<script type=text/javascript src=scripts/jqueryuploadifyvminjs></script>
<script type=text/javascript>
$(document)ready(function () {
$(#uploadify)uploadify({
uploader: Flash/uploadifyswf
script: UploadHandlerashx
cancelImg: Images/cancelpng
folder: Uploads
queueID: fileQueue
//fileDesc: *rar;*jpg;*gif
//fileExt: *rar;*jpg;*gif
sizeLimit: //M
auto: false
multi: true
onError: function (a b c d) {
if (dstatus == )
alert(Could not find upload script);
else if (dtype === HTTP)
alert(error + dtype + : + dstatus);
else if (dtype === File Size)
alert(cname + + dtype + Limit: + Mathround(dsizeLimit / ) + KB);
else
alert(error + dtype + : + );
}
});
});
</script>
</head>
<body>
<div class=easyuitabs >
<div title=上传文件列表 id=fileQueue >
</div>
<!<div title=已上传文件 id=fileUploaded closable=false >
</div>>
</div>
<input type=file name=uploadify id=uploadify />
<p>
<a javascript:$(#uploadify)uploadifyUpload()>全部上传</a>| <a javascript:$(#uploadify)uploadifyClearQueue()>
全部取消</a>
</p>
</body>
</html>
UploadHandlerashx文件代码
<%@ WebHandler Language=C# Class=UploadHandler %>
using System;
using SystemIO;
using SystemNet;
using SystemWeb;
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
contextResponseContentType = text/plain;
contextResponseCharset = utf;
//获取上传文件队列
HttpPostedFile oFile = contextRequestFiles[Filedata];
if (oFile != null)
{
string topDir = contextRequest[folder];
//创建顶级目录
if (!DirectoryExists(HttpContextCurrentServerMapPath(topDir)))
{
DirectoryCreateDirectory(HttpContextCurrentServerMapPath(topDir));
}
//当天上传的文件放到已当天日期命名的文件夹中
string dateFolder = HttpContextCurrentServerMapPath(topDir) + \\ + DateTimeNowDateToString(yyyyMMdd);
if (!DirectoryExists(dateFolder))
{
DirectoryCreateDirectory(dateFolder);
}
oFileSaveAs(dateFolder + \\ + oFileFileName);
contextResponseWrite();
}
else
{
contextResponseWrite();
}
}
public bool IsReusable
{
get { return false; }
}
}