if (itm.AttachmentModel.AttachmentFile != null) { itm.AttachmentModel.AttachmentURL = string.Format("{0}.{1}", Guid.NewGuid().ToString(), itm.AttachmentModel.AttachmentFile.FileName.Split('.')[1]); if (itm.AttachmentModel.AttachmentFile != null) { var path = Path.Combine(Server.MapPath("~/App_Data/Attachments/"), itm.AttachmentModel.AttachmentURL); itm.AttachmentModel.AttachmentFile.SaveAs(path); } }
<input type="hidden" value="" name="..."><input type="file" name="AttachmentFile">
public HttpPostedFileBase AttachmentFile { get; set; } public string AttachmentURL { get { return attachment; } set { attachment = value; } } public string Attachment { get { return attachment; } set { attachment = value; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)