【发布时间】:2020-01-29 07:11:46
【问题描述】:
我想将上传的文件发送到邮箱。这是我的 asp.net 代码。我收到错误
for (int x = 0; x < Request.Files.Count; x++)
{
HttpPostedFile PostedFile = Request.Files[x];
if (PostedFile != null && PostedFile.ContentLength > 0)
{
string FileName = System.IO.Path.GetFileName(PostedFile.FileName);
string FilePath = System.IO.Path.GetFullPath(PostedFile.FileName);
try
{
message.Attachments.Add(new Attachment(FilePath));
}
catch (Exception ex)
{
throw ex;
}
}
}
错误:
找不到文件 'C:\Program Files (x86)\IIS Express\GraceCancerFoundation.png'。实际路径: E:\GraceCancerFoundation.png
【问题讨论】: