Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
i wanted to convert a video file into base64 to get it in xml format

What I have tried:

var bytes[] = File.ReadAllBytes("filepath");
Posted
Updated 23-Mar-16 5:52am

It doesn't matter if it's a video or audio or any other sort of file or byte-array. The input for base64 is a byte-array and it doesn't care for the semantic content.

There are several articles here on CodeProject presenting base64-encoding and -decoding, take a look: Search - CodeProject[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-Mar-16 11:53am    
5ed, see my 5 cents in Solution 2.
—SA
Sascha Lefèvre 23-Mar-16 18:21pm    
Thank you Sergey, my 5 for you as well. Forgot about those methods ;)
Sergey Alexandrovich Kryukov 24-Mar-16 16:42pm    
Thank you, Sascha.
—SA
This is not really a "conversion" — please see Solution 1.

It's here:
Convert.ToBase64String Method (Byte[]) (System)[^],
Convert.FromBase64String Method (String) (System)[^].

However, the whole idea looks quite questionable.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900