Click here to Skip to main content
13,256,716 members (54,012 online)
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 23-Mar-16 3:46am
Updated 23-Mar-16 6:52am
Rate this: bad
 
good
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[^]
  Permalink  
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: bad
 
good
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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 25 Mar 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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