Web APIs - FileReader - FileReader.readAsDataURL()
发布日期:2021-05-06 23:03:00 浏览次数:27 分类:技术文章

本文共 791 字,大约阅读时间需要 2 分钟。

文章目录

FileReader.readAsDataURL()

The readAsDataURL method is used to read the contents of the specified or . When the read operation is finished, the becomes DONE, and the loadend is triggered. At that time, the attribute contains the data as a representing the file’s data as a base64 encoded string.

Note: The blob’s cannot be directly decoded as Base64 without first removing the Data-URL declaration preceding the Base64-encoded data. To retrieve only the Base64 encoded string, first remove data:*/*;base64, from the result.

instanceOfFileReader.readAsDataURL(blob);

  • blob

    The or from which to read.


选择、读取单个文件并预览

在这里插入图片描述

            
Image preview...

选择、读取多个文件并预览

在这里插入图片描述

            
Reading multiple files

参考

上一篇:Web API - File - Using object URLs to display PDF
下一篇:Web API - File - Selecting files using drag and drop

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年04月02日 12时04分05秒