开发者

Why me read.readAsDataURL always error

开发者 https://www.devze.com 2023-03-13 00:41 出处:网络
Below is a part of my program. function displayFile(file) { document.getElementById(\"name\").textContent = file.fileName;

Below is a part of my program.

function displayFile(file) {
    document.getElementById("name").textContent = file.fileName;
    document.getElementById("size").textContent = file.fileSize;

    var reader = new FileReader();

    reader.onload = function(event) {
        document.getElementById('file-content').innerHTML = "Succeed!";
    };

    reader.onerror = function(e) {
        document.getElementById('file-content').innerHTML = "Unable to read " + file.fileName;
   开发者_开发知识库 };

    reader.readAsDataURL(file);
}

why it always occurs an error?...

0

精彩评论

暂无评论...
验证码 换一张
取 消