This should work, at least with Kentico 13. Check that you have the whole base64 string and correct file size. Do you have the correct version of the documentation (you're linking to 8.1)?
var filename = @"C:\test.pdf";
var file = System.IO.File.ReadAllBytes(filename);
Convert.ToBase64String(file); // AttachmentBinary
var fileInfo = new FileInfo(filename);
fileInfo.Length; // AttachmentSize