问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/58688863/encode-form-data-while-fileupload-true-in-extjs-form-submit