asp.net中多个文件的上传

来源:互联网 发布:淘宝个人店铺营业执照 编辑:程序博客网 时间:2024/06/06 13:05

1.   建立一个asp.net页面, 其中包含3个FILEUPLOAD控件与一个按钮控件

2: .CS的代码中的按钮上传事件:

protected void Button1_click(Object sender,Eventargs e)

{

string filepath="C:\\Uploads";保存上传文件的路径

HttpFileConllection uploadfiles=Request.Files;

for(int i=0;i<uploadfiles.count;i++)

{

HttpPostedFiles userPostFile=uploadfiles[i];

try

{

if(userPostFile.ContentLenght>0)

{

userPostFile.saves(filepath+system.IO.path,GetfileName(userPostFile.FileName));

}

}

catch(Exceptin e)

{

new throw e;

}

}

}

 

原创粉丝点击