Plupload.js触发上传文件时出现错误

时间:2016-05-24 15:08:15

标签: javascript plupload

即时通讯使用plupload.js(看起来非常容易使用)通过简单的表单上传文件。当我调用uploader.start()方法时,我在控制台中收到以下错误“plupload.full.min.js:14 Uncaught SYNTAX_ERR:SYNTAX_ERR:DOMException 12”

无法弄清楚为什么,任何想法?提前谢谢。

var uploader = new plupload.Uploader({
      browse_button: 'browse', // this can be an id of a DOM element or the DOM element itself
      url: uploadFileTo,
    });
    uploader.init();

    uploader.bind('FilesAdded', function(up, files) {
          var html = '';
          var date = new Date();
          var fullDate = date.getDate() + '/' + (date.getMonth() + 1) + '/'  + date.getFullYear();
          var iconType = '<i class="fa fa-check-circle esmerald"></i>'
          plupload.each(files, function(file) {
          html += '<tr id="' + file.id + '"><td> ' + iconType + ' </td><td class="fileName">' + file.name + '</td><td>' + plupload.formatSize(file.size) + ' <b></b></td><td> ' + file.type + '</td><td> ' + fullDate + '</tr>';
          });
          document.getElementById('fileTable').innerHTML += html;
        });
    uploader.bind('UploadProgress', function(up, file) {
      document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
    });
    uploader.bind('Error', function(up, err) {
      document.getElementById('error').innerHTML += "\nError #" + err.code + ": " + err.message;
    });

    //when i click on sendFiles button i get the error
    document.getElementById('sendFiles').onclick = function() {
        uploader.start();
        console.log("uploading files");
    };

0 个答案:

没有答案