Waqar Haider
Waqar Haider

Reputation: 971

Multiple file uploads Extjs 6 modern toolkit

I have done multiple file upload in Extjs Classic Now i want to implement it in Modern toolkit but there are issue there is no fileButton Field So i'm using filefield, But i'm not sure how can i get the file data from the filefield here is the code:

                             {
                                xtype: 'fieldset',
                                title: 'Attechments',
                                reference: 'attachmentfile',
                                padding: 10,
                                layout: {
                                    type: 'vbox',
                                    align: 'stretch'
                                },
                                defaults: {
                                    labelWidth: 130
                                },
                                items: [
                                    {
                                        xtype: 'filefield',
                                        text: 'Attach Files',
                                        name: 'files',
                                        listeners:{
                                            change: 'onFileChange'
                                        }
                                    }
                                ]
                            }

and in Viewcontroller:

onFileChange: function (field, e, value) {
       // how to get fileField data so that i can upload via ajax and attach //more files options
}

Upvotes: 1

Views: 992

Answers (1)

khmurach
khmurach

Reputation: 484

In ExtJS 6 Classic Toolkit:

var file = filefield.fileInputEl.dom.files[0];

In ExtJS 6 Modern Toolkit:

var file = filefield.getComponent().getFiles()[0];

Classic demo here

Modern demo here

Upvotes: 0

Related Questions