Using an <input type="file" name="fileUpload"> I can get the file path by using Request.MapPath and storing it in a string. But when I do:
string file = Request.MapPath(Request.Form["fileUpload"]);
Attachment.Add(new Attachment(file));
I get the ‘Could not find a part of the path’ error. What an I missing in getting the file or attaching the file to the MailMessage object?
I believe you cannot do that because the file has not been written to the server disk; that is, it is buffered in memory. Try this: