Difference between revisions of "Template:Convert file to base64-encoding using CSharp"

From Updox API
Jump to: navigation, search
(Created page with " byte[] xmlDataByteArray; System.IO.FileStream inFile; inFile = new FileStream("C:\\filename.ext", FileMode.Open, FileAccess.Read); xmlDataByteArray = new byte...")
 

Latest revision as of 11:23, 3 December 2013

 byte[] xmlDataByteArray;
 
 System.IO.FileStream inFile;
 
 inFile = new FileStream("C:\\filename.ext", FileMode.Open, FileAccess.Read);
 
 xmlDataByteArray = new byte[inFile.Length];
 
 long bytesRead = inFile.Read(xmlDataByteArray, 0, Convert.ToInt32(inFile.Length));
 
 inFile.Close();
 
 String strBase64 = Convert.ToBase64String(xmlDataByteArray, 0, xmlDataByteArray.Length);