Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict file type using xtype filefield(extjs 4.1.0)?

Tags:

extjs

extjs4.1

I am trying to implement file upload feature using extjs 4.1.0. Whereas I want to restrict users to select only image files(jpg,png,gif). Is there any filter which can be applied so that users will only be able to see and then select the types of the files mentioned above?

like image 265
Supereme Avatar asked Feb 18 '23 19:02

Supereme


1 Answers

You could stuff like this as well :

    {
        xtype: 'filefield',
        buttonText: '....',
        listeners:{
            afterrender:function(cmp){
              cmp.fileInputEl.set({
                accept:'image/*' // or w/e type
              });
            }
        }
    }
like image 63
Stranded Kid Avatar answered Mar 05 '23 00:03

Stranded Kid