我正在尝试上传Extjs 3.4和php中的文件...但我无法得到它...所有文本字段都可以发送(我看firebug来演示它)我意识到fileuploadfield没有发送到php文件生成一个Json ......这是我的代码:
this.formAdd = new Ext.Panel({
fileUpload:true,
border:false,
items:[{
layout:'absolute', xtype:'form', border:true, width:490, height:300, id:'actividadPer', name:'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){
alert(Ext.getCmp('actividadPer').getForm().getCmp('txtUrl').getValue());
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?>'); }
}
}]
});
var ob=this;
this.ventNew = new Ext.Window({
resizable : false, //no se puede redimensionar
title:'<?=Title_junior80?>',width:500,height:350, plain:true, bodyStyle:'background:#FFF;', modal:true, items:[this.formAdd],
buttons:[
{
text:'<?=Title_guardad?>',
handler:function(){
Ext.getCmp('actividadPer').guardar();
}
}
]
}).show();
答案 0 :(得分:0)
我认为你还应该在submit()方法中传递enctype参数。
`Ext.getCmp('actividadPer').getForm().submit({ url: 'jr_dirweb_store.php', method: 'POST',enctype : 'multipart/form-data', params:{pedido:'agregar'}`,
sucess:function(form,action){
-----------------
------------------
},
failure:function(error,action){
-----------------
------------------
}
});
答案 1 :(得分:0)