DeLe
DeLe

Reputation: 2480

Extjs 4.1 - Multi select and upload file

I see this tutorial in http://www.rahulsingla.com/blog/2012/03/extjs-3-enabling-multiple-file-uploads-using-textfield#comment-2097

i try it like below but i can't select multi file to upload

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

Here is my code http://jsfiddle.net/baKxc/
What should i do to make that work thank.


Edit: If i do in this post. It looks great, but i can't get file in php server. How can i do to work thank

Upvotes: 5

Views: 10218

Answers (3)

Christoph
Christoph

Reputation: 1023

The Ext JS fileField can just handle single file uploads. I would suggest to use pure html inside your Ext JS app instead

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

see my code on JSFiddle

Upvotes: 2

Neil McGuigan
Neil McGuigan

Reputation: 48236

{
    xtype:'fileField',
    listeners:{
        afterrender:function(cmp){
            cmp.fileInputEl.set({
                multiple:'multiple'
            });
        }
    }
}

Upvotes: 11

Hariharan
Hariharan

Reputation: 3263

You need to set multiple: 'multiple' to element. I'm not sure it has been blinded in your code. Please refer below working example link for reference

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

Upvotes: 0

Related Questions