紧急求助(急!急!急!急!急!急!急!急!急!)
在IE中一次选中多个文件进行上传(不是多个FILE框进行选择),如有人提供原代码和控件者价格可以商量! 问题点数:0、回复次数:8Top
1 楼Proyang(小过)回复于 2004-12-03 12:18:07 得分 0
嘿嘿,UPTop
2 楼goody9807(http://goody9807.cnblogs.com)回复于 2004-12-03 12:42:34 得分 0
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using Bestcomy.Web.Controls.Upload;
namespace AspNetUpload
{
/// <summary>
/// MultiUpload 的摘要说明。
/// </summary>
public class MultiUpload : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox box_comments;
protected System.Web.UI.WebControls.Label txt_result;
protected System.Web.UI.WebControls.Button btn_upload;
private void Page_Load(object sender, System.EventArgs e)
{
BestcomyUpload upldr = new BestcomyUpload();
upldr.RegisterProgressBar("ProgressBar.aspx",btn_upload); //注册上传进度条。
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();
foreach(UploadFile file in upldr.GetUploadFiles("file1"))
{
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();
}
}
}
Top
3 楼shoutor(www.mouxiao.com)回复于 2004-12-03 12:48:17 得分 0
http://blog.csdn.net/shoutor/archive/2004/11/08/172013.aspxTop
4 楼chen99yjeyotech(语过添情)回复于 2004-12-03 12:48:42 得分 0
你可以把要上传的文件放到一个列表控件中,然后利用一个循环语把这些文件上传.Top
5 楼zskyc(zsyk1)回复于 2004-12-03 13:40:24 得分 0
各位兄弟,我要的不是上面所说的,我要的是像在应用程序下一次选择多个文件上传,就我所知是要做控件,但不知如何下手,还请高手请教Top
6 楼xuandme000(水丝游云)回复于 2004-12-03 13:43:57 得分 0
”各位兄弟,我要的不是上面所说的,我要的是像在应用程序下一次选择多个文件上传,就我所知是要做控件,但不知如何下手,还请高手请教“
可以吗?没有听说过!Top
7 楼nhf80649(懒星星)回复于 2004-12-03 13:50:08 得分 0
关注~~~Top
8 楼zskyc(zsyk1)回复于 2004-12-06 09:04:38 得分 0
各位高人,我曾经找到一老外作的,可以实现的(有演示地址,但现在我出差在外,网址没记),跟他联系过几次,就没音信了。还请高手们多帮帮忙Top




