How to store files with meta data in LoopBack?

前端 未结 7 1732
别跟我提以往
别跟我提以往 2020-11-28 03:05

What I want to do: Have an html form, with a file input inside. When a file is chosen, the file input should upload the file, and get a file id, so when the form is submitte

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 03:55

    For AngularJS SDK users... In case you would like to use generated methods like Container.upload(), you might want to add a line to configure the method in lb-services.js to set Content-Type headers to undefined. This would allow client to set Content-Type headers and add boundary value automatically. Would look something like this:

     "upload": {
        url: urlBase + "/containers/:container/upload",
        method: "POST",
        headers: {"Content-Type": undefined}
     }
    

提交回复
热议问题