Click here to Skip to main content
14,240,435 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]
   
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100