ExtJS 4.2.2 HTML 5 Multi File Upload

Posted By Vitaliy | February 20, 2014 | ExtJS 4.2.2
1 15261
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: TreePanel From Uploaded Xml File Without Xml Attributes

Posted By Vitaliy | March 09, 2013 | ExtJS 4.1.1
0 3195
​Xml file sample here.

Js Code

var form = win.down('form').getForm();
if (form.isValid()) {
    form.submit({
        url: '/upload/xml2',
        waitMsg: 'Uploading your xml file...',
        success: function (f, a) {
            var result = a.result,
                data = result.data,
                store = tree.getStore();

            win.close();

            store.setRootNode(data);
            tree.expandAll();
        },
        failure: function (f, a) {
            Ext.Msg.alert('Failure', a.result.msg);
        }
    });
}
            

ExtJS 4: TreePanel From Uploaded Xml File

Posted By Vitaliy | February 24, 2013 | ExtJS 4.1.1
0 3408
​Xml file sample here.

Js Code

var form = win.down('form').getForm();
if (form.isValid()) {
    form.submit({
        url: '/upload/xml',
        waitMsg: 'Uploading your xml file...',
        success: function(f, a) {
            var result = a.result,
                data = result.data,
                store = tree.getStore();

            win.close();

            store.setRootNode(data);
            tree.expandAll();
        },
        failure: function(f, a) {
            Ext.Msg.alert('Failure', a.result.msg);
        }
    });
}
            

ExtJS 4 Upload To ASP.NET MVC Demo

Posted By Vitaliy | February 24, 2013 | ExtJS 4.1.1
0 4927
​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);
        }
    });
}