PDA

View Full Version : File field not working in Extjs 4.1 ?



surindersammy
27 Jun 2012, 9:31 PM
Hi,

I have one form with filefiled xtype. But its could not working. Its have so many problems,

When i submit form is not post correct form file field data.


Ext.define('Saas.view.Masters.Companies.Form.CompaniesForm', {extend : 'Ext.form.Panel',
alias : 'widget.CompaniesForm',
id : 'CompaniesAddForm',
method : 'POST',
enctype:'multipart/form-data',
fileUpload: true,
isUpload: true,


initComponent: function (arguments) {
var me = this;
Ext.apply(me, {
autoHeight : true,
width : 920,
bodyPadding : 5,
items: [{
xtype: 'filefield',
name: 'logo_name',
fieldLabel: 'Photo',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Select Photo...',
listeners : {
change: function(btn, name, eOpts) {
Ext.getCmp('companyLogo').setSrc(this.getValue()) ;
}
}
},{
xtype : 'button',
text: 'Upload',
handler: function() {
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'photo-upload.php',
waitMsg: 'Uploading your photo...',
success: function(fp, o) {
Ext.Msg.alert('Success', 'Your photo "' + o.result.file + '" has been uploaded.');
}
});
}
}
}]
});
me.callParent(arguments);
}
});


Thanks,

scottmartin
28 Jun 2012, 12:52 PM
What is sent in your header?
Do you get a response from the server? Can you provide this please.

We will need a bit more info to help.

Scott.

surindersammy
28 Jun 2012, 9:30 PM
Hi Scottmartan,

When i post form then, show data with post request in firebug.



logo_name :?JFIF??`?`???Adobe?d????]Exif??MM?*????2???????b;???????vGF???????GI???????????????????? ?????i???????}???2009:03:12 13:46:42?Corbis??????????????????????54????????54?????????????2008:03:14 13:59:26?2008:03:14 13:59:26???????????????)??????1??????9?????????????H??????H????JFIF???????C?  (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egc?C//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc??x? "???????????? ????}?!1AQa"q2?#BR$3br? %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????? ???w?!1AQaq"2B? #3Rbr$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz??????????????????? ????K |`?*[mǦx*)=r|<).fY~b=qxvU˥?s/#?j̼kH1?? n^1q\s`]B??<?E""7D:?ǨV.IdSj۴w2lܩ=Hu q~ ,pWm.J x??nh??F;?ocW??R&???vz?Ȭ,bf'~5nk[L?Dm=,7?7TWrk&N7)S%ͲI#S0ۯU??c(rQIbQ...
etc...


I am using codeigniter Framwork in backend

Thanks,