Conversion to Base64 format

Hi @dubeychanan,

Refer this link,
c# - Converting file into Base64String and back again - Stack Overflow

If you want for some reason to convert your file to base-64 string. Like if you want to pass it via internet, etc… you can do this

Byte[] bytes = File.ReadAllBytes("path")
String file = Convert.ToBase64String(bytes)
And correspondingly, read back to file:

Byte[] bytes = Convert.FromBase64String(b64Str)
File.WriteAllBytes(path, bytes)

Regards,
Arivu

5 Likes