社区
Web Services
帖子详情
Asp.net C# 如何实现 多文件 多文件上传
jason20002001
2009-04-25 09:04:16
Asp.net C# 如何实现 多文件 多文件上传
...全文
64
1
打赏
收藏
Asp.net C# 如何实现 多文件 多文件上传
Asp.net C# 如何实现 多文件 多文件上传
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
蓝海D鱼
2009-04-25
打赏
举报
回复
多文件上传
Code
private void upMorefile()
{
HttpFileCollection files = Request.Files;
System.Text.StringBuilder strMsg = new System.Text.StringBuilder("上传的文件信息分别为:<hr color=red>");
int fileCount;
try
{
for (fileCount = 0; fileCount < files.Count; fileCount++)
{
HttpPostedFile postedFile = files[fileCount];
string fileName, fileExtension;
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != String.Empty)
{
fileExtension = System.IO.Path.GetExtension(fileName);
strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "<br>");
strMsg.Append("客户端文件地址:" + postedFile.FileName + "<br>");
strMsg.Append("上传文件的文件名:" + fileName + "<br>");
strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr color=red>");
postedFile.SaveAs(Server.MapPath("upedFile/") + fileName);
}
}
strStatus.Text = strMsg.ToString();
}
catch (System.Exception error)
{
strStatus.Text = error.Message;
}
}
protected void Upload_Click(object sender, EventArgs e)
{
upMorefile();
}
Code
<head id="Head1" runat="server">
<title></title>
<script language="JavaScript">
function addFileControl() {
var str = '<INPUT type="file" NAME="File">'
document.getElementById('FileCollection').insertAdjacentHTML("beforeEnd", str)
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="upMoreFile" method="post" encType="multipart/form-data" runat="server">
<asp:label id="Title" Runat="server"></asp:label>
<P id="FileCollection"><INPUT type="file" name="File">
</P>
<P><input onclick="addFileControl()" type="button" value="增加(File)">
<asp:button id="Upload" Runat="server" Text="上传" Width="56px" OnClick="Upload_Click"></asp:button>
<input style="WIDTH: 56px; HEIGHT: 24px" onclick="this.form.reset()" type="button" value="重置">
</P>
<p>
<asp:label id="strStatus" runat="server" BorderColor="White" BorderStyle="None" Width="544px"
Font-Size="9pt" Font-Bold="True" Font-Names="宋体"></asp:label> </p>
</form>
</body>
asp.net
(
c#
)多
文件
上传
及将
文件
信息保存到数据库
在
asp.net
中用
C#
实现
多
文件
上传
,在上传成功后将
文件
信息保存到数据库中。在上传时还会检查上传者是否有上传权限(本例中是学生没有上传权限,教师有)。
ASP.NET
中
实现
多
文件
上传
实例
一个简单的
ASP.NET
实现
多
文件
上传
代码
ASP.NET
Core 基础 部署至Linux
第一讲什么是
ASP.NET
Core 第二讲
ASP.NET
Core 基本架构 第三讲
ASP.NET
Core OWIN 第四讲 创建
ASP.NET
Core第一个程序 第五讲
ASP.NET
Core 运行静态
文件
1 第六章
ASP.NET
Core运行默认
文件
第七讲
ASP.NET
Core ...
ASP.NET
C#
上传多个
文件
例子
ASP.NET
C#
上传多个
文件
例子 演示网页上传多个
文件
例子
asp.net
上传、读出、删除
文件
asp.net
操作
文件
的上传、读出、删除等操作!!!
Web Services
12,162
社区成员
16,328
社区内容
发帖
与我相关
我的任务
Web Services
.NET技术 Web Services
复制链接
扫一扫
分享
社区描述
.NET技术 Web Services
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章