II have an asp.net form with a FileUpload function. This section is working correctly:
protected void UploadCertificate(object sender, EventArgs e)
string fileName = quality_certificate.FileName;
quality_certificate.SaveAs(MapPath("fileuploads/" + fileName));
LabelQC.Text = "File " + fileName + " has uploaded";
LabelQC.Text = "No file uploaded";
However when I try to retreive this file on submitting the form, it will not attach to the email presumably because the MapPath line is incorrect? Any advice welcome!
Attachment attachFile = new Attachment(Server.MapPath("fileuploads/" + quality_certificate.FileName));
For example when its hard coded it works:
Attachment attachFile = new Attachment(Server.MapPath("fileuploads/logo.gif"));// THIS WORKS
The directory is fileuploads within the root of the web site.
Permissions set to 775.