PDA

View Full Version : fileupload content in java



harikumar.meda
13 Jan 2011, 1:39 AM
hi,
I am uploading a file in extjs and i am able to get all the field values except file

here is my js code:
var backupForm = new Ext.FormPanel({
id: 'backupDetails-form',
frame: true,
labelAlign: 'left',
title: 'BackUp And Restore',
bodyStyle:'padding:5px',
width: '100%',
height: '100%',
layout: 'column', // Specifies that the items will now be arranged in columns
items: [{
columnWidth: 0.4,
xtype: 'fieldset',
labelWidth: 140,
title:'BackUp And Restore',
defaults: {width: 140}, // Default config options for child items
defaultType: 'textfield',
autoHeight: true,
bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;',
border: true,
style: {
"margin-left": "10px", // when you add custom margin in IE 6...
"margin-right": Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0" // you have to adjust for it somewhere else
},
items: [operation_combo,{
fieldLabel: 'Enter Database',
name: 'db_name',
value: 'smartcard',
allowBlank: false

},{
xtype: 'fileuploadfield',
id: 'file',
//emptyText: '',
fieldLabel: 'File Location',
name: 'file',
allowBlank: false
}],
buttons: [{
text: 'Backup',
id: 'backup_btn',
name: 'backup_btn',
handler: function() {
var v = backupForm.getForm().isValid();
if(v){
var viewBean=backupForm.getForm().getValues();
InfoFacade.backupDB(viewBean,{
callback: function(response){
backupForm.getForm().reset();
}
});

}else{
Ext.Msg.show({
title:'Error',
msg: 'Please fix the validation Error',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}

},
disabled: true

},{
text: 'Reset',
handler: function() {
backupForm.getForm().reset();
}

}]
}],
renderTo: 'backupContent'
});

My bean class looks like this

String operation_type;
String db_name;
byte[] file;


i am able to get operation_type, db_name but file is showing null.


what is the datatype i need to use in java class to get filupload content?