scorpiusjs / scorpius

Modular admin solution built with Meteor
http://scorpiusjs.org
MIT License
34 stars 7 forks source link

What is the data format expected by scorpius.filesystem.upload() ? #12

Closed krishaamer closed 7 years ago

krishaamer commented 8 years ago

Hello!

I'm recording video in the browser using lukemadera:video-capture and would like to save it to MongoDB using the scorpius filesystem. So I was wondering what's the expected format of "fileList" ? Probably I should also do something with base64Data before saving.

scorpius.filesystem.upload({
            fileList: base64Data,
            name: "somename",
            uploader: 'file-attribute'
          });

Any advice would be appreciated.

-Kris

krishaamer commented 8 years ago

If anyone has the same question, here's what I ended up using:

let blob = dataURItoBlob(base64Data);
let files = [];
files.push(blob);

let upload = scorpius.filesystem.upload({
            fileList: files,
            name: "file name",
            uploader: 'file-attribute'
});

Tracker.autorun(function () {
            if (upload.ready()) {
              console.log(upload.fileId)
            }
});

Tracker.autorun(function () {
            let progress = upload.progress();
            console.log(progress);
});
rwatts3 commented 8 years ago

This is Awesome, and a great use of the filesystem. Once the documentation and forum site be sure to post this as a solution.