コード例 #1
0
        public int UploadDocument(string filePath)
        {
            string hex = string.Empty;

            using (FileStream fs = File.OpenRead(filePath))
            {
                byte[] contents = new byte[fs.Length];

                fs.Read(contents, 0, Convert.ToInt32(fs.Length));
                fs.Close();

                hex = Convert.ToBase64String(contents);
            }

            DocumentDTO documentDTO = new DocumentDTO()
            {
                HexString = hex,
                Extension = Path.GetExtension(filePath)
            };

            return(_databaseFunctions.AddNewDocument(documentDTO));
        }