namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
byte[] array = File.ReadAllBytes("D:\\test.jpg");
string base64string = Convert.ToBase64String(array);
// Write first 30 chars.
MessageBox.Show(base64string.Substring(0, 30) + "...");
}
}
}
/*
run:
/9j/4AAQSkZJRgABAQAAAQABAAD/2w...
*/