1

I want to validate file types from server side in loopback. I am using loopback-component-storage for the file storage. For validating file types from server side, I created a boot file and added code:

app.dataSources.storage.connector.allowedContentTypes = ["image/jpg", "image/jpeg", "image/png"];

where "storage" is my datasource. Now, is it possible to change this file formats based on to which container the file is pointed to. ie. if I have two containers "profiles" and "images", is it posible to restrict uploads to profiles as just "csv" and uploads to images as "jpg or png". Thanks in advance! Please help and also suggest any other methods for doing so, if exists.

Phoenix Dev
  • 412
  • 2
  • 17

1 Answers1

2

A possible solution may be to set up your own upload method. Something similar is done here.

Community
  • 1
  • 1
yotamsha
  • 349
  • 1
  • 7