0

I am using Meteor-Restivus for exposing API Endpoints.

https://github.com/kahmali/meteor-restivus/

But here I am unable to upload Multipart File. What I have tried so far is:

Api.addRoute('questions/:question/photo', {authRequired: true}, {
        post: function () {
            var uploadedFile = new FS.File(this.request.files.photo.path);
            var insertedFile =  Photos.insert(uploadedFile, function (err, fileObj) {
                if (err) {
                    console.log(err);
                } else {
                    console.log(fileObj.size()+" "+fileObj.name()+" "+fileObj.extension());
                }
            });

            return {
                status: "success",
                data: insertedFile._id
            }
        }
    }
);

But it says photo is undefined.

I am posting payload like this:

enter image description here

StormTrooper
  • 1,731
  • 4
  • 23
  • 37

0 Answers0