public bool UploadDocument(UploadDocument uploadDocument) { bool result = true; FileStream fileStream = null; BinaryWriter writer = null; try { string saveFilePath = @"\\cfileserver\Documents\DocumentUpload\" + uploadDocument.FileName; fileStream = File.Open(saveFilePath, FileMode.Create); writer = new BinaryWriter(fileStream); writer.Write(uploadDocument.FileStream); } catch (Exception) { result = false; } finally { if (fileStream != null) { fileStream.Close(); } if (writer != null) { writer.Close(); } } return(result); }
public bool UploadDocument(UploadDocument uploadDocument) { bool result = true; FileStream fileStream = null; BinaryWriter writer = null; try { string saveFilePath = @"\\cfileserver\Documents\DocumentUpload\" + uploadDocument.FileName; fileStream = File.Open(saveFilePath, FileMode.Create); writer = new BinaryWriter(fileStream); writer.Write(uploadDocument.FileStream); } catch (Exception) { result = false; } finally { if (fileStream != null) fileStream.Close(); if (writer != null) writer.Close(); } return result; }