ASP.NET使用SWFUpload上传大文件教学
2009-04-22 16:34
302 查看
Code
protected void Page_Load(object sender, EventArgs e)
{
Response.CacheControl = "no-cache";
s_rpath = Server.UrlDecode(Request.QueryString["Path"]).Replace("\\","\\\\") ;
s_rppath = Server.UrlDecode(Request.QueryString["ParentPath"]).Replace("\\","\\\\");
if (Request.QueryString["type"] != null)
{
if (Request.QueryString["type"] == "mov")
{
DataTable dt = Sys.BasePramStart();
string Flvdir = dt.Rows[0]["flvsavepath"].ToString();
string Datedir = DateTime.Now.ToString("yy-MM-dd"); ;
string updir = Flvdir + s_rpath;
if (this.Page.Request.Files.Count > 0)
{
try
{
for (int j = 0; j < this.Page.Request.Files.Count; j++)
{
HttpPostedFile uploadFile = this.Page.Request.Files[j];
if (uploadFile.ContentLength > 0)
{
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
string extname = Path.GetExtension(uploadFile.FileName);
string fullname=DateTime.Now.Year.ToString()+DateTime.Now.Month.ToString()+DateTime.Now.Day.ToString()+ DateTime.Now.Hour.ToString()+DateTime.Now.Minute.ToString()+DateTime.Now.Second.ToString();
string filename = uploadFile.FileName;
if (Request.QueryString["recname"] == "1")
{
filename = string.Format("{0}{1}", fullname, extname);
}
uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
}
}
}
catch (Exception ex)
{
Record("111", ex.ToString());
}
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
Response.CacheControl = "no-cache";
s_rpath = Server.UrlDecode(Request.QueryString["Path"]).Replace("\\","\\\\") ;
s_rppath = Server.UrlDecode(Request.QueryString["ParentPath"]).Replace("\\","\\\\");
if (Request.QueryString["type"] != null)
{
if (Request.QueryString["type"] == "mov")
{
DataTable dt = Sys.BasePramStart();
string Flvdir = dt.Rows[0]["flvsavepath"].ToString();
string Datedir = DateTime.Now.ToString("yy-MM-dd"); ;
string updir = Flvdir + s_rpath;
if (this.Page.Request.Files.Count > 0)
{
try
{
for (int j = 0; j < this.Page.Request.Files.Count; j++)
{
HttpPostedFile uploadFile = this.Page.Request.Files[j];
if (uploadFile.ContentLength > 0)
{
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
string extname = Path.GetExtension(uploadFile.FileName);
string fullname=DateTime.Now.Year.ToString()+DateTime.Now.Month.ToString()+DateTime.Now.Day.ToString()+ DateTime.Now.Hour.ToString()+DateTime.Now.Minute.ToString()+DateTime.Now.Second.ToString();
string filename = uploadFile.FileName;
if (Request.QueryString["recname"] == "1")
{
filename = string.Format("{0}{1}", fullname, extname);
}
uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
}
}
}
catch (Exception ex)
{
Record("111", ex.ToString());
}
}
}
}
}
相关文章推荐
- ASP.NET使用SWFUpload上传大文件教学(源码) (转)
- ASP.NET使用SWFUpload上传大文件教学(源码)
- asp.net中使用swfupload上传大文件
- ASP.NET使用SWFUpload上传文件_修正版
- ASP.NET中如何使用SWFUpload上传文件
- asp.net中使用swfupload上传大文件
- 怎样在ASP.NET中使用VB.NET上传大文件
- Asp.NET使用HTML控件上传文件
- asp.net下使用DIME协议上传文件
- Asp.net_使用FileUpload控件上传文件通用方法分享
- asp.net下使用DIME协议上传文件
- asp.net使用plupload实现文件上传
- ASP.NET 使用ajaxupload.js插件出现上传较大文件失败的解决方法
- ASP.NET中使用fckeditor上传文件出现“The server didn't send back a proper XML response……”
- asp.net(c#)开发中的文件上传组件uploadify的使用方法(带进度条)
- 在asp.net mvc中使用Uploadify上传文件
- asp.net文件上传用到html的file控件,在使用母版页Master,更改form的Enctype=multipart/form-data的方法
- Asp.Net Mvc 使用jQuery实现Ajax文件上传
- ASP.NET上传下载文件示例,使用webClient实现
- asp.net 使用纯jquery上传控件 fineuploader实现多文件上传