0

I have a ext form with textfield and one filefield. Without filefield form is working fine, and when submit the form data sending with encoded format. But When set fileupload = true, form data sending with different format. with fileupload data sending like..

form data
  name: abc,
  email: abc@gmail.com

When not set fileupload data sending like..

data="%5Bobject%20Object%5D"

But I want to send data encoded format with fileupload also. How can I do this, please share some idea.Thanks in advance.

Raj
  • 439
  • 1
  • 8
  • 28

1 Answers1

0

You did not post any code sample so it's hard to follow your description. I guess what you are describing here is that your form is being submitted as multipart/form-data because you are uploading a file. You can disable detection in extjs https://docs.sencha.com/extjs/7.0.0/modern/Ext.form.Panel.html#cfg-multipartDetection However if you want to transfer files you should keep the current configuration. You would have to encode the uploaded file yourself and sending files as part of your request body will most likely be slow(er), especially if the files are very large. Please see e.g. https://stackoverflow.com/a/4526286/836086

The problem you are dealing with is most likely the request parser you use, not the form using multipart/form-data as both encodings should be handled equally by higher level code.

Jonas Osburg
  • 1,733
  • 1
  • 14
  • 17
  • will i send you form code ? so that you can give some idea. – Raj Nov 05 '19 at 05:54
  • $US.formWindow = new ExtFormWindow({ id: 'users-form', window: { title: $tr('users_form'), width: 460, height: 460 }, form: { url: Scada.reqUrl('users', 'save'), loadUrl: Scada.reqUrl('users', 'form'), padding: '0 0 0 0', fileUpload: true, items: $US.formTabPanel }, events: { onFormLoadComplete: $US.formLoaded, onBeforeSubmit: $US.formSubmit, onFormSubmitComplete: $US.storeReload, onFormSubmitFailed: $US.showError } }); – Raj Nov 05 '19 at 05:55
  • Ext.each(['vis', 'schedulers', 'trends', 'emergency'], function(type) { var sel = Ext.getCmp('users-access-' + type) , value = sel.getValue() , list = []; if (value == 'P') { list = Ext.getCmp('users-tree-' + type).getChecked('id'); if (!list.length) { sel.setValue(''); } } acl[ type ] = list; }); console.log(acl); $US.formWindow.form.findField('acl').setValue(Ext.encode(acl)); $US.formReset(); }; – Raj Nov 05 '19 at 05:55
  • Please edit the original question and add formated code there! It's very hard to read your comments. But as I said: Please clarify why you don't want `multipart/form-data`. In case of a file upload this encoding is usually what you want to use – Jonas Osburg Nov 05 '19 at 09:00