)解壓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; }
}
}
From:http://tw.wingwit.com/Article/program/ASP/201311/21705.html