public static string ConvertUploadFileToBase64(HttpPostedFileBase file) { using (MemoryStream memoryStream = new MemoryStream()) { file.InputStream.CopyTo(memoryStream); byte[] binaryData = memoryStream.ToArray(); string base64String = Convert.ToBase64String(binaryData); return base64String; } }
var base64Str =Tool.ConvertUploadFileToBase64(Request.Files.Get(0));
标签:memoryStream,C#,base64,binaryData,二进制,file,MemoryStream From: https://www.cnblogs.com/mtjj/p/17680596.html