本人测试代码 下载 http://download.csdn.net/source/1862674<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>SWFUpload Demos - Application Demo</title> <link href="css/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="swfupload.js"></script> <script type="text/javascript" src="js/handlers.js"></script> <script type="text/javascript" src="js/swfupload.queue.js"></script> <script type="text/javascript"> var swfu; window.onload = function () { swfu = new SWFUpload({ // Backend Settings upload_url: "upload.aspx", // Relative to the SWF file or absolute post_params: {"PHPSESSID": "<%=Guid.NewGuid().ToString() %>"}, file_size_limit : "2MB", // 2MB file_types : "*.jpg;*.gif;*.png;", file_types_description : "图片(jpg,gif,png)", file_upload_limit : 100,
custom_settings : { progressTarget : "fsUploadProgress", cancelButtonId : "btnCancel" }, // Event Handler Settings - these functions as defined in Handlers.js // The handlers are not part of SWFUpload but are part of my website and control how // my website reacts to the SWFUpload events. file_queued_handler : fileQueued, file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_start_handler : uploadStart, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete,
里面有一个专门上传flv视频文件的控件,是别人先做好的可以批量上传,还可以看到进度条,很实用!
等等 一会我给你找找下载地址
这个地址就是 你把代码下载下来以后改良一下就可以用了。很方便, 我就那么用的
有个类:SharpZipLib
你去搜索一下
System.IO.Compression
但是我没用过
下载
http://download.csdn.net/source/1862674<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SWFUpload Demos - Application Demo</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="swfupload.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript" src="js/swfupload.queue.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: "upload.aspx", // Relative to the SWF file or absolute
post_params: {"PHPSESSID": "<%=Guid.NewGuid().ToString() %>"}, file_size_limit : "2MB", // 2MB
file_types : "*.jpg;*.gif;*.png;",
file_types_description : "图片(jpg,gif,png)",
file_upload_limit : 100,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
}, // Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
// Button Settings
button_image_url : "images/XPButtonNoText_65x22.png", // Relative to the SWF file
button_placeholder_id : "spanButtonPlaceholder",
button_width: 65,
button_height: 22,
button_text : '浏览',
button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
button_text_left_padding: 18,
button_text_top_padding: 1,
// Flash Settings
flash_url : "swfupload.swf",
// Debug Settings
debug: false
});
}; </script>
</head>
<body>
<div id="content">
<form style="clear:both;padding-top:5px;padding-left:15px;" id="subForm">
<span id="spanButtonPlaceholder"></span>
<input id="startUpload" type="button" value="上传" onclick="imgUpoload()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
<input id="btnComplete" type="button" value="完成" onclick="btmComplete()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
<input id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
</form> <div class="fieldset flash" id="fsUploadProgress"><span class="legend">上传列表</span></div>
<div id="thumbnails"></div>
</div>
</body>
</html>using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;public partial class upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (this.IsPostBack)
{
//foreach (HttpPostedFile a in Request.Files)
//{
// a.SaveAs(Server.MapPath("~/Upload/") + a.FileName);
// Response.Write("FILEID:" + a.FileName);
//}
String fname = Request.Form["Filename"];
FileInfo f = new FileInfo(fname);
fname = Guid.NewGuid() + "." + f.Extension;
String fullName = Server.MapPath("~/Upload/" + fname);
Request.Files[0].SaveAs(fullName);
Response.Write("FILEID:" + fname);
//using (FileStream fs = new FileStream(fullName, FileMode.Create, FileAccess.Write))
//{
// byte[] buffer = new byte[Request.InputStream.Length];
// int bts = Request.InputStream.Read(buffer, 0, buffer.Length);
// fs.Write(buffer, 0, bts);
// fs.Close();
// Response.Write("FILEID:" + fname);
//}
}
}
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class thumbnail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String file = Request.QueryString["id"]!=null?"Upload/"+Request.QueryString["id"]:String.Empty;
file = Server.MapPath("~/"+file);
if (System.IO.File.Exists(file))
{
Response.WriteFile(file);
}
}
}