0

I have image upload field like

{
    xtype: 'textfield',  
    fieldLabel: 'Image',  
    labelSeparator: '',  
    name: 'newPic',  
    id:'newPic',  
    anchor:'100%',  
    inputType: 'file',  
    allowBlank: false  
}

When i submitting form, Im encoding all form data in a json object.All textfields data are coming in json object but not image is passing to server side . How to pass image so as to save it in server side

var form=Ext.getCmp('empPersonal');
var formdata=Ext.JSON.encode(form.getValues());
alert(""+formdata);
if(Ext.getCmp('empPersonal').getForm().isValid()) {
    Ext.Ajax.request({ 
    url:'ws/employees/create/'+formdata,
4

1 回答 1

0

您应该使用Ext.form.field.File而不仅仅是textfield. 此控件将允许用户浏览本地计算机上的文件,并且此文件将包含在发送到服务器的 POST 消息中:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.File

于 2012-04-19T12:41:53.370 回答