How to store files with meta data in LoopBack?

前端 未结 7 1740
别跟我提以往
别跟我提以往 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:48

    For those who are looking for an answer to the question "how to check file format before uploading a file".

    Actual in this case we can use optional param allowedContentTypes.

    In directory boot use example code:

    module.exports = function(server) {
        server.dataSources.filestorage.connector.allowedContentTypes = ["image/jpg", "image/jpeg", "image/png"];
    }
    

    I hope it will help someone.

提交回复
热议问题