如何从单个文件上传控件将多个文件附加到邮件 [英] How to attach multiple files to mail from single file upload control
问题描述
我正在尝试将多个图像文件附加到来自文件上传控件的邮件中。
它被附加但当我试图打开那些图像时它没有打开。
以下代码更清晰
使用(MailMessage mm = new MailMessage(senderId,receiverId))
{
foreach (HttpPostedFile已上传文件 imgUpload.PostedFiles)
{
string FileName = Path.GetFileName(uploadedFile.FileName);
mm.Attachments.Add( new 附件(uploadedFile.InputStream,FileName));
}
}
其中 imgUpload =具有AllowMultiple属性的文件上传控件 true
在此先感谢
我尝试过:
使用(MailMessage mm = new MailMessage(senderId,receiverId))
{
foreach(HttpPostedFile在imgUpload.PostedFiles中上传文件)
{
string FileName = Path.GetFileName (uploadedFile.FileName);
mm.Attachments.Add(new Attachment(uploadedFile.InputStream,FileName));
}
}
您好,请参阅以下链接获取您的帮助:
使用附件发送邮件d使用ASP.Net进行多文件上传 [ ^ ]
http://www.aspdotnet-suresh.com/2012/12/aspnet-upload-multiple-files-using.html [ ^
I am trying to attach multiple Image files to mail from file upload control.
Its being attached but when I am trying to open those image its not opening.
below codes for more clarity
using (MailMessage mm = new MailMessage(senderId, receiverId))
{
foreach (HttpPostedFile uploadedFile in imgUpload.PostedFiles)
{
string FileName = Path.GetFileName(uploadedFile.FileName);
mm.Attachments.Add(new Attachment(uploadedFile.InputStream, FileName));
}
}
where imgUpload= file upload control with AllowMultiple properties "true"
Thanks In Advance
What I have tried:
using (MailMessage mm = new MailMessage(senderId, receiverId))
{
foreach (HttpPostedFile uploadedFile in imgUpload.PostedFiles)
{
string FileName = Path.GetFileName(uploadedFile.FileName);
mm.Attachments.Add(new Attachment(uploadedFile.InputStream, FileName));
}
}
Hi please see the below links for your help:
Sending Mail With Attachment and Multiple File Upload Using ASP.Net[^]
http://www.aspdotnet-suresh.com/2012/12/aspnet-upload-multiple-files-using.html[^]
这篇关于如何从单个文件上传控件将多个文件附加到邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!