Search Posts

angular schema form image upload accepting all file types

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.

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *