【发布时间】:2016-04-23 02:30:16
【问题描述】:
我正在使用 fileupload 将图像上传到 asp.net 网站,我需要通过电子邮件发送上传的图像来执行此操作我将图像保存到 erver 上的文件夹,然后我正在发送图像但我可以发送它之前没有保存到文件夹中,或者如果我需要将其保存到文件夹中,我可以在发送后立即删除它吗? 谢谢。
我的代码:
string filename = Path.GetFileName(file.FileName);
file.SaveAs(Server.MapPath("UploadImages/" + filename));
string attachmentPath = Server.MapPath("UploadImages/" + filename);
Attachment inline = new Attachment(attachmentPath);
inline.ContentDisposition.Inline = true;
inline.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
inline.ContentType.Name = Path.GetFileName(attachmentPath);
mail.Attachments.Add(inline);
【问题讨论】:
标签: asp.net file-upload