我想选择多个图像并将它们转换为Base64字符串。我把文件推入一个数组中。我的要求是,在转换成Base64字符串后,我想将它们推送到一个数组中。我无法将图像转换为Base64字符串。如何将图像转换为文件中的Base64字符串?
$("input[name=property_images]").change(function() {
var names = [];
for (var i = 0; i < $(this).get(0).files.length; ++i) {
names.push($(this).get(0).files[i].name);
}
\t console.log(names);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<input type="file" name="property_images" multiple="multiple" />
我和角度做过,只是警告你,如果你有超过一个图标更大的一个图像比你的浏览器在处理字符串时遇到的主要问题只要base64。它崩溃了我的铬,我根本无法使用base64方法! –