示例#1
0
        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);
        }
示例#2
0
        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;
        }