6

I'm using loopback Api Explorer I need to upload a file by explore how can I upload that because I don't find any option to upload file please refer the screenshot

enter image description here.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sparsh Pipley
  • 451
  • 8
  • 22
  • 1
    Have you looked into the Loopback Storage component? https://docs.strongloop.com/display/public/LB/Storage+component – JSimonsen Sep 08 '15 at 18:27
  • If your on Mac you can also git Paw a go https://paw.cloud/ see the documenation on file upload/multipart body https://paw.cloud/docs/getting-started/set-request-body#Set_Multipart_body – Matthaus Woolard Oct 18 '16 at 04:53

3 Answers3

4

Simply put, the answer is that you can't. Uploading a file requires multi-part form data. This isn't currently possible via the loopback-component-explorer. You should checkout the loobpack-component-storage instead. There is an example here; I recommend using the example-2.0.

richardpringle
  • 796
  • 5
  • 22
1

You can test it with something like POSTMAN.

But, the only that you need, is the path of the file, not the file.

MatCas
  • 773
  • 8
  • 19
1

Simpler than using Postman would be using curl direct on the terminal :

Here is the command I use when need(I work with some services using loopback/explorer as well) :

curl -i -X POST -H "Content-Type: multipart/form-data" -F "blob=@/path/to/your/file.jpg" -v http://HOST:PORT/pathToYourEndpoint?access_token=xxxxxxxxxxx

Marco Barcellos
  • 196
  • 2
  • 4