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‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ�������� ÿÄ�µ��w�!1AQaq"2B‘¡±Á #3RðbrÑ$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ� ��?�Kà¢£É ¸|`ԑ*[mÇ¦xÎ*Ñ)=±r|½Ù<÷)×.fY~b=qÍxvÙUË¥‹ò¤s/#‘Ðúj̼¹kHÄ1œ¿Š· ¡nÙ^ö1q\sÔ`Ñ]ÚBŠ³±’<Ò¨?çõ©µE"×"¢Ó7D:”ǨëV.åIádSóÓjÛ´Êwç2lçòÜ©=H­½Þu³ Æìqõ®~ ,»Îp£õíWm.JËåõ x«©ꊔnhږ™FÈüê;ç؀öéøÐocWòœžÀR¾&„Ž½ÿ�¨¬vz“½È¬,bf¹Ý'Þ²ú~5nëk[L™DmÎ=ºÓ,Ïî7Ž7TWrk&N7)¢îS%«ÈͲI#´S0Û¯ÔU›‰c(ÞrïQÁÀÁ¢ÒÖIbQ...
etc...


I am using codeigniter Framwork in backend

Thanks,