带进度条的文件上传控件使用小结
2006-03-14 13:49
447 查看
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<script type="text/javascript"><!--
google_ad_client = "pub-0380950997514063";
/* 横向五个 */
google_ad_slot = "7194863803";
google_ad_width = 728;
google_ad_height = 15;
// --></script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
一、上传界面内容
说明:为了能正确显示,把原有asp.NET按钮控件换成了HTML的按钮控件
二、后台代码
1.page_load部分内容
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
UpLoadHelper helper = new UpLoadHelper();
helper.RegisterProgressBar(bt_save.UniqueID);
string path = Path.Combine(Server.MapPath("."),"loadfile");
if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
helper.UploadFolder = path;
bind();
}
2.加入了自定义的显示上传文件夹的文件列表方法
public void bind()
{
string path = Path.Combine(Server.MapPath("."),"loadfile");
if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
Table1.Rows.Clear();
foreach(string filename in Directory.GetFiles(path))
{
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Text = filename;
r.Cells.Add(c);
Table1.Rows.Add(r);
}
}
3.批量上传文件的代码
UpLoadHelper helper = new UpLoadHelper();
string path = Path.Combine(Server.MapPath("."),"loadfile");
foreach(UpLoadFile file in helper.GetUploadFileList("file1"))
{
file.SaveAs(Path.Combine(path,Path.GetFileName(file.FileName)));
}
bind();
4.单个文件上传的代码
UpLoadHelper helper = new UpLoadHelper();
string path = Path.Combine(Server.MapPath("."),"loadfile");
UpLoadFile file = helper.GetUploadFile("s_file");
file.SaveAs(Path.Combine(path,Path.GetFileName(file.FileName)));
bind();
三、说明
<script type="text/javascript"><!--
google_ad_client = "pub-0380950997514063";
/* 横向五个 */
google_ad_slot = "7194863803";
google_ad_width = 728;
google_ad_height = 15;
// --></script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
一、上传界面内容
选择文件: 上 传 |
选择文件: 上 传 |
二、后台代码
1.page_load部分内容
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
UpLoadHelper helper = new UpLoadHelper();
helper.RegisterProgressBar(bt_save.UniqueID);
string path = Path.Combine(Server.MapPath("."),"loadfile");
if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
helper.UploadFolder = path;
bind();
}
2.加入了自定义的显示上传文件夹的文件列表方法
public void bind()
{
string path = Path.Combine(Server.MapPath("."),"loadfile");
if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
Table1.Rows.Clear();
foreach(string filename in Directory.GetFiles(path))
{
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Text = filename;
r.Cells.Add(c);
Table1.Rows.Add(r);
}
}
3.批量上传文件的代码
UpLoadHelper helper = new UpLoadHelper();
string path = Path.Combine(Server.MapPath("."),"loadfile");
foreach(UpLoadFile file in helper.GetUploadFileList("file1"))
{
file.SaveAs(Path.Combine(path,Path.GetFileName(file.FileName)));
}
bind();
4.单个文件上传的代码
UpLoadHelper helper = new UpLoadHelper();
string path = Path.Combine(Server.MapPath("."),"loadfile");
UpLoadFile file = helper.GetUploadFile("s_file");
file.SaveAs(Path.Combine(path,Path.GetFileName(file.FileName)));
bind();
三、说明
相关文章推荐
- 不使用ASP.NET中的服务器控件将如何上传文件?
- 使用uploadify控件上传大文件错误处理记录
- 使用servlet实现简易上传文件(带进度条版本)
- ext 多文件上传控件 Ext.ux.UploadDialog 使用中的问题
- yii上传图片、yii上传文件、yii控件activeFileField使用
- 使用FileUpload控件上传文件时对文件大小
- .net使用FileUpLoad控件上传文件
- 使用Java、Jquery、Ajax实现的带进度条的文件上传。
- aspx 下使用原生html 控件上传文件的问题
- 带进度条的HTML5上传文件(使用XMLHttpRequest对象)
- 使用FileUpload控件上传文件时对文件大小的限制
- Extjs 使用fileupload插件上传文件 带进度条显示
- ASP.NET 2.0使用FileUpload控件上传文件示例
- ASP.NET 2.0使用FileUpload控件上传文件示例
- asp.net不使用服务器控件上传文件时的无意问题
- Asp.net_使用FileUpload控件上传文件通用方法分享
- asp.net(c#)开发中的文件上传组件uploadify的使用方法(带进度条)
- 使用 jQuery progressBar 做文件上传的进度条指示
- [翻译]带进度条的文件上传控件
- 使用Uploadify(UploadiFive)多文件上传控件遇到的坑