ExtJS 4.2.2 HTML 5 Multi File Upload

By Vitaliy on February 20, 2014. ExtJS 4.2.2
13397
The multiple attribute is new in HTML5.
Note: the multiple attribute is supported in Internet Explorer 10, Firefox, Opera, Chrome, and Safari.

Js Code

items: {
    xtype: 'form',
    border: false,
    bodyStyle: {
        padding: '10px'
    },
    items: {
        xtype: 'multifilefield',
        labelWidth: 80,
        fieldLabel: 'Choose file(s)',
        anchor: '100%',
        allowBlank: false,
        margin: 0
    }
},    

ExtJS 4 Upload To ASP.NET MVC Demo

By Vitaliy on February 24, 2013. ExtJS 4.1.1
4425
‚ÄčNote: server response type should be "text/html".

Js Code

var form = this.up('form').getForm();
if (form.isValid()) {
    form.submit({
        url: '/upload/file',
        waitMsg: 'Uploading your file...',
        success: function (f, a) {
            var result = a.result,
                data = result.data,
                name = data.name,
                size = data.size,
                message = Ext.String.format('<b>Message:</b> {0}<br/>' +
                    '<b>FileName:</b> {1}<br/>' +
                    '<b>FileSize:</b> {2} bytes',
                    result.msg, name, size);

            Ext.Msg.alert('Success', message);
        },
        failure: function (f, a) {
            Ext.Msg.alert('Failure', a.result.msg);
        }
    });
}