Angular1流星文件上传不起作用

时间:2016-10-17 09:55:58

标签: meteor fs angular-meteor

未捕获TypeError:数据不是Blob或文件(...)UploadFS.Uploader @ ufs-uploader.js:47(匿名函数)@ methods.js:23reader.onload @ helpers.js:44

将流星从1.3上传到1.4。文件上传无效

methods.js

export function upload(dataUrl, name, resolve, reject) {
// convert to Blob
const blob = dataURLToBlob(dataUrl);
blob.name = name;

// pick from an object only: name, type and size
const file = _.pick(blob, 'name', 'type', 'size');

// convert to ArrayBuffer
blobToArrayBuffer(blob, (data) => {
  const upload = new UploadFS.Uploader({
    data,
    file,
    store: ImagesStore,
    onError: reject,
    onComplete: resolve
  });

  upload.start();
}, reject);

}

1 个答案:

答案 0 :(得分:0)

你是否从https://github.com/jalik/jalik-ufs加载了最新的软件包 - 从Meteor 1.3到1.4有一些重大变化:

重大变化

UploadFS.readAsArrayBuffer()是DEPRECATED

方法UploadFS.readAsArrayBuffer()不再可用,因为上传使用POST二进制数据,我们不需要ArrayBuffer。