Q
Qweertz
I'm trying to send e-mail with attachment that I take from FileUpload
control.
The problem is how to get full path of file.
For instance when I have file "C:\test.txt" FileUpload1.PostedFile.FileName
gets only "test.txt" and sending mail fails.
Can someone help?
Here's the code:
MailMessage mail = new MailMessage();
mail.From = "(e-mail address removed)";
mail.To = txtEmail.Text;
mail.Subject = "Anouncment about new Contract";
mail.Body = "Siging code is :" + txtSigningCode.Text;
mail.BodyFormat = MailFormat.Text;
mail.Attachments.Add(new MailAttachment(FileUpload2.PostedFile.FileName));
SmtpMail.Send(mail);
control.
The problem is how to get full path of file.
For instance when I have file "C:\test.txt" FileUpload1.PostedFile.FileName
gets only "test.txt" and sending mail fails.
Can someone help?
Here's the code:
MailMessage mail = new MailMessage();
mail.From = "(e-mail address removed)";
mail.To = txtEmail.Text;
mail.Subject = "Anouncment about new Contract";
mail.Body = "Siging code is :" + txtSigningCode.Text;
mail.BodyFormat = MailFormat.Text;
mail.Attachments.Add(new MailAttachment(FileUpload2.PostedFile.FileName));
SmtpMail.Send(mail);