1

我已经在 Extjs Classic 中完成了多个文件上传现在我想在现代工具包中实现它但是有问题没有 fileButton 字段所以我正在使用文件字段,但我不确定如何从文件字段中获取文件数据这是代码:

                             {
                                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'
                                        }
                                    }
                                ]
                            }

在视图控制器中:

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

1 回答 1

0

在 ExtJS 6 经典工具包中:

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

在 ExtJS 6 现代工具包中:

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

经典演示在这里

现代演示在这里

于 2017-06-23T23:54:16.333 回答