Reputation: 327
loopback-component-storage doc for file (or files) upload says this: loopback documentation
Description:
Upload one or more files into the specified container. The request body must use multipart/form-data which the file input type for HTML uses.
Method:
upload(req, res, cb)
REST URI:
POST
/api/containers/:container/upload
Would someone please show an example of how to create this multipart/form request in Angular/Javascript?
Upvotes: 6
Views: 3164
Reputation: 1442
You can go through code in Loopback Storage example git repository. It internally uses angular-file-upload library which would be beneficial in the future to add filtering on the type, size and number of files.
This example doesn't use lb-services
but uses direct calls using $http
module.
You'll be able to upload files using the example code. Please let me know in case you need to know angular-file-upload filters to filter out files based on size, type or number of files.
Upvotes: 4