(100)请教~:FileUpload 上传发送问题.
代码
protected void butSubmit_Click(object sender, EventArgs e)
{
string tels = this.toList.Text.Trim();
//处理上传文件
HttpFileCollection fileColllection = HttpContext.Current.Request.Files;
System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
List<byte> byteList = new List<byte>();
try
{
for (int iFile = 0; iFile < fileColllection.Count; iFile++)
{
//检查文件扩展名字
HttpPostedFile postedFile = fileColllection[iFile];
string fileExtension;
string fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (!string.IsNullOrEmpty(fileName))
{
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>");
string savePath = HttpContext.Current.Request.MapPath(".") + "/upload/" + fileName;
postedFile.SaveAs(savePath);
byteList.AddRange(PackFiles.PackFiles.MakeTmsContent(savePath));
}
}
}
页面
<div align="left">发送的手机号码:<asp:TextBox ID="toList" runat="server" Width="218px"></asp:TextBox></div>
<div align="left">打包的彩信文件:<asp:FileUpload ID="File1" runat="server" /></div>
<div align="left">打包的彩信文件:<asp:FileUpload ID="File2" runat="server" /></div>
<div align="center">
<asp:Button ID="butSubmit" runat="server" Text="提交" Width="75px" OnClick="butSubmit_Click" /></div>
怎么改能让一个FileUpload能上传发送几个文件呢
这个是彩信测试发送的一段代码
一个FileUpload 提交的图片或文字 发出去是单独在一个彩信的页面的
我想要发出去实现一张图片和一段文字在同一个彩信页面 请问怎么实现呢·谢谢!
protected void butSubmit_Click(object sender, EventArgs e)
{
string tels = this.toList.Text.Trim();
//处理上传文件
HttpFileCollection fileColllection = HttpContext.Current.Request.Files;
System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
List<byte> byteList = new List<byte>();
try
{
for (int iFile = 0; iFile < fileColllection.Count; iFile++)
{
//检查文件扩展名字
HttpPostedFile postedFile = fileColllection[iFile];
string fileExtension;
string fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (!string.IsNullOrEmpty(fileName))
{
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>");
string savePath = HttpContext.Current.Request.MapPath(".") + "/upload/" + fileName;
postedFile.SaveAs(savePath);
byteList.AddRange(PackFiles.PackFiles.MakeTmsContent(savePath));
}
}
}
页面
<div align="left">发送的手机号码:<asp:TextBox ID="toList" runat="server" Width="218px"></asp:TextBox></div>
<div align="left">打包的彩信文件:<asp:FileUpload ID="File1" runat="server" /></div>
<div align="left">打包的彩信文件:<asp:FileUpload ID="File2" runat="server" /></div>
<div align="center">
<asp:Button ID="butSubmit" runat="server" Text="提交" Width="75px" OnClick="butSubmit_Click" /></div>
怎么改能让一个FileUpload能上传发送几个文件呢
这个是彩信测试发送的一段代码
一个FileUpload 提交的图片或文字 发出去是单独在一个彩信的页面的
我想要发出去实现一张图片和一段文字在同一个彩信页面 请问怎么实现呢·谢谢!
...全文
相关推荐
用FileUpload控件上传文件到数据库
用FileUpload控件上传文件到数据库! 值得下载看看!资源免费,大家分享!!
asp.net FileUpload 上传进度条
完美进度条,监控文件上传大小以及百分比
使用commons-fileupload上传文件
使用commons-fileupload上传文件 使用commons-fileupload上传文件
SpringBoot+fileUpload获取文件上传进度
主要为大家详细介绍了SpringBoot+fileUpload获取文件上传进度,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
commons-fileupload文件上传实例
用commons-fileupload实现文件上传功能,两个文件搞定!!!!


