How to get form-data from a restApi

Hi everybody,

I have a problem with restful services as I’m using nimble:restivus. It’s a great package but it’s not supporting form-data and I have to upload a file with rest. Converting the file to base64 is not an option. I tried to figure it out but got lost in npm.

Is there a recommended way to upload a file with rest in Meteor? Thank you.

Answer is already in this forum : How to get form-data body in Picker?
I use Picker too and happy with it to upload images and videos.

I solved the problem with picker and multer

If anyone needs:

Picker.middleware(multer().any());

Picker.route('api_url', function(params, req, res)
{  
  console.log(req.body);
  console.log(req.files[0]);
  
  res.end(200);
});
1 Like

great thanks for this, it’s the only thing on the internet that worked for me

1 Like