请问谁有上传文件进度条代码?? 只要能按实际的文件大小跟上传进度条同步完成就ok 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.lionsky.net/MyWebsite/downsoft/List.Aspx?id=225 namespace AspNetUpload{ /// <summary> /// SingleUpload 的摘要说明。 /// </summary> public class SingleUpload : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox box_comments; protected System.Web.UI.WebControls.Button btn_upload; protected System.Web.UI.WebControls.Label txt_result; private void Page_Load(object sender, System.EventArgs e) { BestcomyUpload upldr = new BestcomyUpload(); string fpath = Path.Combine(Server.MapPath("."),"Upload"); if(!Directory.Exists(fpath)) Directory.CreateDirectory(fpath); upldr.UploadFolder=fpath; //设置上传文件临时目录,要求ASPNET用户对该文件夹有写权限。 } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.btn_upload.Click += new System.EventHandler(this.btn_upload_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion /// <summary> /// 获取最大可上传文件大小。 /// </summary> /// <returns></returns> protected double GetMaxRequestLength() { double maxLength=0; string sPath = typeof(String).Assembly.Location; sPath = Path.GetDirectoryName(sPath); sPath = Path.Combine(sPath,"CONFIG\\machine.config"); XmlDocument doc=new XmlDocument(); doc.Load(sPath); maxLength=Convert.ToDouble(doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength").Value); doc.Load(Path.Combine(Request.PhysicalApplicationPath,"web.config")); XmlNode node=doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength"); if(node!=null) { double length=Convert.ToDouble(node.Value); if(length<maxLength) maxLength=length; } return maxLength/1024; } private void btn_upload_Click(object sender, System.EventArgs e) { string fpath = Path.Combine(Server.MapPath("."),"Upload"); StringBuilder sb = new StringBuilder(); sb.Append("<hr>说明文字:"+box_comments.Text+"<br>"); sb.Append("上传文件列表:<br>"); sb.Append("<table border='1'>"); sb.Append("<tr><td>文件名</td><td>大小</td></tr>"); BestcomyUpload upldr = new BestcomyUpload(); UploadFile file = upldr.GetUploadFile("file1"); if(file!=null) { file.SaveAs(Path.Combine(fpath,Path.GetFileName(file.FileName))); sb.Append("<tr><td>"+Path.GetFileName(file.FileName)+"</td><td>"+file.ContentLength.ToString("###,###")+" 字节</td></tr>"); } sb.Append("<table>"); txt_result.Text = sb.ToString(); } }} http://www.lionsky.net/MyWebsite/downsoft/List.Aspx?id=225 >http://bestcomy.europe.webmatrixhosting.net 给你一个孟老大的参考http://dotnet.aspx.cc/ShowDetail.aspx?id=794566B9-5EA2-4782-2D42-E133F3C7BA74 请问谁有Bestcomy.Web.Controls.Upload.dll和AspNetUpload.dll源代码 我要的是bin目录里组件的源代码!!?????? shit我还以为这个lionsky实现了纯客户端的进度条原来还是要定时刷新进度条窗口,由服务器更新进度对话框页面…… lionsky也是参考外国的源码,我有,但还有很多bug,因为这方面的技术还好像不大成熟,所以很小应用到实际中,谁留个空间给我上传,大家可以拿去研究修改 请问如何在微软报表中显示其他数据集信息? 关于JQuery 和 WS ScriptMethod(UseHttpGet = true)? asp.net如何实现网页重定向 鼠标经过 图片变大 完美的效果 AJAX菜鸟,解释点代码啊 正则表达式字符串长度问题 现在在做一个考试系统遇到一个很棘手的问题求教! vs怎么做tree,试向高手求代码! Response.Redirect()的问题 如何解决客户端传递数字和英文参数出错的问题? "指定的转换无效"怎么办? 两个简单问题,请大家帮忙啊~~~~~~~~~~~!
{
/// <summary>
/// SingleUpload 的摘要说明。
/// </summary>
public class SingleUpload : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox box_comments;
protected System.Web.UI.WebControls.Button btn_upload;
protected System.Web.UI.WebControls.Label txt_result;
private void Page_Load(object sender, System.EventArgs e)
{
BestcomyUpload upldr = new BestcomyUpload();
string fpath = Path.Combine(Server.MapPath("."),"Upload");
if(!Directory.Exists(fpath))
Directory.CreateDirectory(fpath);
upldr.UploadFolder=fpath; //设置上传文件临时目录,要求ASPNET用户对该文件夹有写权限。
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btn_upload.Click += new System.EventHandler(this.btn_upload_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion /// <summary>
/// 获取最大可上传文件大小。
/// </summary>
/// <returns></returns>
protected double GetMaxRequestLength()
{
double maxLength=0;
string sPath = typeof(String).Assembly.Location;
sPath = Path.GetDirectoryName(sPath);
sPath = Path.Combine(sPath,"CONFIG\\machine.config");
XmlDocument doc=new XmlDocument();
doc.Load(sPath);
maxLength=Convert.ToDouble(doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength").Value);
doc.Load(Path.Combine(Request.PhysicalApplicationPath,"web.config"));
XmlNode node=doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength");
if(node!=null)
{
double length=Convert.ToDouble(node.Value);
if(length<maxLength)
maxLength=length;
} return maxLength/1024;
} private void btn_upload_Click(object sender, System.EventArgs e)
{
string fpath = Path.Combine(Server.MapPath("."),"Upload"); StringBuilder sb = new StringBuilder();
sb.Append("<hr>说明文字:"+box_comments.Text+"<br>");
sb.Append("上传文件列表:<br>");
sb.Append("<table border='1'>");
sb.Append("<tr><td>文件名</td><td>大小</td></tr>"); BestcomyUpload upldr = new BestcomyUpload();
UploadFile file = upldr.GetUploadFile("file1");
if(file!=null)
{
file.SaveAs(Path.Combine(fpath,Path.GetFileName(file.FileName)));
sb.Append("<tr><td>"+Path.GetFileName(file.FileName)+"</td><td>"+file.ContentLength.ToString("###,###")+" 字节</td></tr>");
}
sb.Append("<table>");
txt_result.Text = sb.ToString();
}
}
}
我还以为这个lionsky实现了纯客户端的进度条原来还是要定时刷新进度条窗口,由服务器更新进度对话框页面……