5

我在http://www.rahulsingla.com/blog/2012/03/extjs-3-enabling-multiple-file-uploads-using-textfield#comment-2097看到了这个教程

我尝试如下,但我无法选择要上传的多个文件

items: [{
        xtype: 'textfield',
        name: 'name[]',
        fieldLabel: 'Name',
        inputType: 'file',
        fieldLabel: 'Multiple file selection',
        autoCreate: { tag: 'input', type: 'text', size: '20', autocomplete: 'off', multiple: 'multiple' }
    }]

这是我的代码http://jsfiddle.net/baKxc/
我应该怎么做才能完成这项工作谢谢。


编辑: 如果我在这篇文章中这样做。它看起来很棒,但我无法在 php 服务器中获取文件。我该怎么做才能工作谢谢

4

3 回答 3

11
{
    xtype:'fileField',
    listeners:{
        afterrender:function(cmp){
            cmp.fileInputEl.set({
                multiple:'multiple'
            });
        }
    }
}
于 2013-08-09T07:19:49.407 回答
2

Ext JS fileField 只能处理单个文件上传。我建议在您的 Ext JS 应用程序中使用纯 html

items: [{
    xtype: 'textfield',
    html: '<form action="yourUploadUrl" method="post" enctype="multipart/form-data"> <input type="file" name="file" multiple id="files" /> <input type="submit" value="Submit" /></form>'
    }]

在JSFiddle上查看我的代码

于 2013-08-10T09:32:26.417 回答
0

您需要将 multiple: 'multiple' 设置为元素。我不确定它是否在您的代码中被蒙蔽了。请参考下面的工作示例链接以供参考

http://ext4all.com/post/extjs-4-multiple-file-upload

http://www.rahulsingla.com/blog/2012/03/extjs-3-enabling-multiple-file-uploads-using-textfield

http://htmlpreview.github.io/?https://github.com/werdender/ext4examples/blob/master/fileupload.html

于 2013-08-02T12:06:41.387 回答