Ext JS - example fileupload
HTML
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css">
<h3>File Upload ExtJs</h3>
<div id="example-form"></div>
CSS
#example-form {
width:90%;
margin:20px;
}
JavaScript
Ext.onReady(function(){
var itemPanel = new Ext.form.FormPanel({
fileUpload : true,
renderTo:'example-form',
items:[new Ext.form.TextField({
id:"iconUpload",
fieldLabel: 'Image',
inputType: 'file',
name: 'appIcon',
width:500
})],
listeners : {
render : function(form){
}
},
buttonAlign: 'center',
buttons: [{
text : 'Submit',
formBind : true,
handler : function(){
itemPanel.getForm().submit({
success: function(form, action){
console.log("Juhu!");
},
failure: function(form, action){
console.log("Bäääh...");
}
});
}
}]
});
});