PDA

View Full Version : send fileuploadfield data to json



flashersv
3 Sep 2014, 5:58 PM
I am trying to upload images but I canīt ... I can send textfield data to Json, but I do not recieve the data of fileuploadfield... this is part of my code:

this.formAdd = new Ext.Panel({
fileUpload:true,
border:false,
items:[{
layout:'absolute', xtype:'form', border:true, width:490, height:300, id:'actividadPer', bodyStyle:'padding-bottom:10px;',
url:'jr_dirweb_store.php',
defaults:{ layout:'form',labelWidth: 50, labelAlign:'top', bodyStyle:'padding-right:10px;padding-left:10px', border:false },
items:[
{ x:0, y:10, items:[{ xtype:'textfield', fieldLabel:'<b>URL</b>', width:460, name:'txtUrl', itemId:'txtUrl',id:'txtUrl',allowBlank:false, vtype:'url',emptyText:'http://' }] },
{ x:0, y:60, items:[{ xtype:'textfield', fieldLabel:'<b>Etiquetas (Espaņol)</b>', width:460, name:'tagses', itemId:'tages',id:'tagses',allowBlank:false }] },
{ x:0, y:110, items:[{ xtype:'textfield', fieldLabel:'<b>Tags (English)</b>', width:460, name:'tagsen', itemId:'tagsen',id:'tagsen',allowBlank:false }] },
{ x:0, y:160, items:[{ xtype: 'fileuploadfield', emptyText: '<?=Title_seleccionar?>', fieldLabel:'<b><?=Title_imagen?></b>', name: 'iconox',id: 'iconox', buttonText:'<?=Title_examinar?>', width:460, allowBlank: false}]},
{ x:0, y:210, items:[{ xtype:'combo', id:'idiomax', fieldLabel:'<b><?=Title_idioma?></b>', forceSelection: true, store: store_combo_cats, width: 150, triggerAction: 'all', editable:false, valueField:'id', displayField:'leng', lastQuery: ''}]},
{ x:200, y:210, items:[{ xtype:'combo', name:'plataformax', id:'plataformax', fieldLabel:'<b><?=Title_junior81?></b>', forceSelection: true, store:store_combo_apps, width: 150,
triggerAction: 'all', editable:false, valueField:'id', displayField:'nombre', mode:'local'}]}

],
guardar:function(){
if (Ext.getCmp('actividadPer').getForm().isValid()) { // Validamos el formulario
Ext.getCmp('actividadPer').getForm().submit({ url: 'jr_dirweb_store.php', method: 'POST', params:{pedido:'agregar'},
success: function(form, action){
Ext.example.msg('<?=Title_guardado?>','<?=Title_adminwebteca16?>');
Ext.getCmp('actividadPer').getForm().reset();
ventanaW.ventNew.close();
storegrid.removeAll();
storegrid.reload();
},
failure:function(form, action){
Ext.example.msg('<?=Title_error?>','Error');
Ext.getCmp('actividadPer').getForm().reset();
}
});
}else{ Ext.example.msg('<?=Title_informacion?>','<?=Title_adminwebteca15?>'); }
}
}]
});


How I said, I only recieve the data of textfield xtypes.

Thanks for the help.

mitchellsimoens
10 Sep 2014, 4:28 AM
File uploading it completely different than a textfield and should be handled on the server side. Cross platform, you will not have access to the file field's data.