Skip to content
Loading
 
+1
  • Vikas Panwar
    +1

    $('INPUT[type="file"]').change(function () {

    var ext = this.value.match(/\.(.+)$/)[1];

    switch (ext) {

    case 'jpg':

    case 'jpeg':

    case 'png':

    case 'gif':

    $('#uploadButton').attr('disabled', false);

    break;

    default:

    alert('This is not an allowed file type.');

    this.value = '';

    }});

    For the front-end it is good convenient to put 'accept' attribute like as.
           accept="image/jpg,image/png,image/jpeg,image/gif" 
    />

    +1
  • +1
    ejs-uploader not input field
    +1
  • +1
     
    Save button click to validate 
    +1