首页 > 其他 > 详细

file文件转Base64

时间:2020-07-10 17:16:27      阅读:70      评论:0      收藏:0      [点我收藏+]

file转Base64

imgFile: 需要转的文件
imgBase64: 输出的Base64码
 
1             var imgBase64
2             var reader = new FileReader();
3             reader.readAsDataURL(imgFile);
4             reader.onload = function () {
5                 imgBase64 = this.result; //获取到base64格式图片
6                 console.log(‘imgBase64‘, imgBase64);
7             };

 

file文件转Base64

原文:https://www.cnblogs.com/hexuerui/p/13280036.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!