2014-09-04 81 views
0

我想上傳Extjs 3.4和php中的文件...但我無法得到它...所有的文本字段都可以發送(我看着螢火蟲來演示它),並且我意識到fileuploadfield沒有發送以產生一個JSON PHP文件...這裏是我的代碼:在Extjs 3.4中的fileuploadfield

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

請忽略此行: alert(Ext.getCmp('actividadPer')。getForm()。getCmp('txtUrl')。getValue()); – user3113655 2014-09-04 05:52:30

回答

0

我想你也應該通過加密類型參數提交()方法。

`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){ 
    ----------------- 
    ------------------ 
} 
}); 
+0

我做到了,但它不工作....你如何看到圖像中,「iconox」(文件上傳字段的名稱和ID)不發送在帖子中:http://www.subirimagenes.net/i /140904041444170041.png – user3113655 2014-09-04 14:17:37