代码 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 提交的图片或文字 发出去是单独在一个彩信的页面的
我想要发出去实现一张图片和一段文字在同一个彩信页面 请问怎么实现呢·谢谢!
{
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 提交的图片或文字 发出去是单独在一个彩信的页面的
我想要发出去实现一张图片和一段文字在同一个彩信页面 请问怎么实现呢·谢谢!
除非是activex插件或者flash控件。
这个是多文件上传,不知道是不是你说的意思
lz参考...<head id="Head1" runat="server">
<title>无标题页</title>
<script type="text/javascript">
function addFileUpLoad(){
var str = '<INPUT type="file" size="43" NAME="File">';
document.getElementById('addFileupLoad').insertAdjacentHTML("beforeEnd",str);
}
</script>
</head><body>
<form id="form1" runat="server">
<div id="addFileupLoad" style="width: 436px;">
<asp:Label ID="Label1" runat="server" Text="点此增加文件" Width="68px"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="上传" onclick="Button1_Click" /><br />
<asp:FileUpload ID="FileUpload1" runat="server" Width="363px" /><br />
<asp:FileUpload ID="FileUpload2" runat="server" Width="363px" /><br />
</div>
</form>
</body>protected void Page_Load(object sender, EventArgs e)
{
Label1.Attributes.Add("onclick", "addFileUpLoad()");
}
protected void Button1_Click(object sender, EventArgs e)
{
bool bo = Save();
if (bo)
{
Response.Write("<script language='javaScript'>alert('上传文件成功!')</script>");
}
}
private Boolean Save()
{
//遍历File表单元素
HttpFileCollection files = HttpContext.Current.Request.Files;
HttpPostedFile postedFile = null;
//状态信息
System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
String path = Server.MapPath("~/File/");
try
{
for (int iFile = 0; iFile < files.Count; iFile++)
{
//检查文件扩展名字
postedFile = files[iFile];
string fileName, fileExtension;
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != "")
{
fileExtension = System.IO.Path.GetExtension(fileName);
postedFile.SaveAs(path + fileName);
}
}
return true;
}
catch (Exception e)
{
e.ToString();
return false;
}
}
彩信 smil文件怎么编辑的呀·用什么工具编辑的呢
然后写了个 smil文件
里面格式:
<smil>
<head>
<layout>
<root-layout width="640px" height="480px"/>
<region id="Image" width="100%" height="90%" left="0%" top="0%" fit="meet"/>
<region id="Text" width="100%" height="100%" left="0%" top="90%" fit="hidden"/>
</layout>
</head>
<body>
<par dur="10000ms">
<img src="1.jpg" region="Image" />
<text src="1.txt" region="Text" />
</par>
</body>
</smil>和图片 1.jpg 与文字1.txt 一起上传 就OK 了! 谢谢大家!~