6

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?

marcospereira
  • 12,045
  • 3
  • 46
  • 52
zi88
  • 327
  • 5
  • 8

1 Answers1

4

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.

Ritesh Jagga
  • 1,387
  • 1
  • 11
  • 23
  • I'm using `$http` module, too, so I guess I'm on the right track. I was hoping `lb-services` could be used, because of course the scaffolding gets created for the remote upload method, but it can't really be used. – Charlie Schliesser Jul 13 '16 at 13:22