Click here to Skip to main content
13,731,121 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 23-Mar-16 2:46am
Updated 23-Mar-16 5:52am
Rate this: bad
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[^]
Sergey Alexandrovich Kryukov 23-Mar-16 11:53am
5ed, see my 5 cents in Solution 2.
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.
Rate this: bad
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.


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 | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 25 Mar 2016
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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