public void UploadFile(FileUpload newFile) { FileStream stream = null; try { var physicalPath = GetFullLocalPath(newFile.Path); stream = new FileStream(physicalPath, FileMode.Create, FileAccess.Write); if (stream.CanWrite) { stream.Write(newFile.Contents, 0, newFile.Contents.Length); } } finally { if (stream != null) { stream.Close(); } } uploadRepository.Insert(newFile); }
public ActionResult UploadFile(FileUpload fileUpload) { fileUploadService.UploadFile(fileUpload); return RedirectToAction("Add"); }
public string GetFullPath(FileUpload fileUpload) { return GetFullLocalPath(fileUpload.Path); }
public FileUpload Insert(FileUpload entity) { connection.Insert(entity); return entity; }