0
여기에 파일 업로드가 필요할 때 첨부 파일과 메일이 필요합니다. 첨부 파일 경로가 잘못되었습니다.메일 첨부 파일에 잘못된 경로가 있습니다.
오류 : 'C : \ Program Files (x86) \ IIS Express \ test.xlsx'파일을 찾을 수 없습니다. // < --Wrong 파일 경로
코드
for (int i = 0; i < fuUploadedFiles.UploadedFiles.Count; i++)
{
if (fuUploadedFiles.UploadedFiles[i] != null)
{
fuUploadedFiles.UploadedFiles[i].SaveAs(ServerPath + "\\" + fuUploadedFiles.UploadedFiles[i].FileName);
using (MailMessage mm = new MailMessage())
{
if (fuUploadedFiles.UploadedFiles.Count != null)
{
string FileName = fuUploadedFiles.UploadedFiles[i].FileName;
mm.Attachments.Add(new Attachment(FileName));//<-- Error generate here
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "mypassword");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
}
}
어떻게'fuUploadedFiles'을 채우고 있습니까? – ovaltein
@Kelix이 Telerik rad 업로드입니다. 올바르게 업로드 된 파일 – TechGuy