I have used the this plugin Angular Schema Form and all the things are working as expected but for image upload i need to have validations so as to allow the users input only images.
although the schema contains an accept attribute in the properties for image upload as follows:
{
"type": "object",
"properties": {
"text1": {
"type": "string",
"title": "Untitled Text field",
"name": "text1",
"url": "http://localhost/image/upload/img59b7c29f1622b.jpeg"
},
"file2": {
"type": "object",
"format": "file",
"title": "Untitled image upload field",
"x-schema-form": {
"type": "file",
"accept": "png|jpg|jpeg|gif"
},
"name": "file2"
}
},
"image": ["text1"]}
Still the validation does not happen and i can choose any file.
I installed this library: https://github.com/saburab/angular-schema-form-nwp-file-upload and it works for me.
For image i used
"pattern": {"mimeType": "image/*} that accept all images.