带进度条的文件上传控件使用小结
来源:互联网 发布:数据恢复软件免费版 编辑:程序博客网 时间:2024/05/19 03:23
<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();
三、说明
- 带进度条的文件上传控件使用小结
- 带进度条的文件上传
- 带进度条的文件上传
- 带进度条的文件上传
- 带进度条的HTML5上传文件(使用XMLHttpRequest对象)
- Android带进度条的文件上传,使用AsyncTask异步任务
- 带进度条的HTML5上传文件(使用XMLHttpRequest对象
- 带进度条的HTML5上传文件(使用XMLHttpRequest对象
- 使用IHttpAsyncHandler实现带进度条的文件上传
- 带真实百分比的上传进度条控件
- 带进度条文件上传
- 带进度条的 Fileupload 上传文件
- 多文件上传带进度条的
- java文件上传带进度条的
- android实现带进度条的文件上传
- XMLHTTPRequest实现带进度条的文件上传
- struts2实现带进度条的文件上传
- Flex 带进度条的文件上传
- 你想跳槽吗?
- 防止盗链下载问题
- Win2K3 Unattended Installations
- 电影网站实现防盗链的方法
- 简单的防盗链(代码)
- 带进度条的文件上传控件使用小结
- Java里的线程模型
- 在ORACLE里用存储过程定期分割表
- 简明oracle8i培训手册
- 在北大校园BBS引起轰动的一篇文章
- Style Report报表软件获得最佳java报表工具奖
- cmd.exe
- “老虎”来了 J2SE1.5(代号:Tiger)新功能一览
- 曾经做的一个项目的经验教训