在Extjs Form Submit中将文件上传为true时对表单数据进行编码 [英] Encode form data while fileupload true in Extjs Form Submit
问题描述
我有一个textfield
和一个filefield
的分机形式.如果不使用filefield
,则表单工作正常,并且在提交表单时以编码格式发送数据.但是当设置fileupload = true
时,将以不同的格式发送数据.
与文件上传数据发送类似.
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"
但是我也想使用fileupload发送数据编码格式. 我该怎么做,请分享一些想法.谢谢.
But I want to send data encoded format with fileupload also. How can I do this, please share some idea.Thanks in advance.
推荐答案
您没有发布任何代码示例,因此很难遵循您的描述.
我想您在这里描述的是您的表单正在作为multipart/form-data
提交,因为您正在上传文件.您可以在extjs https:中禁用检测: //docs.sencha.com/extjs/7.0.0/modern/Ext.form.Panel.html#cfg-multipartDetection
但是,如果要传输文件,则应保留当前配置.您必须自己编码上传的文件,然后
作为请求正文的一部分发送文件很可能会较慢,尤其是在文件很大的情况下.
请参阅 https://stackoverflow.com/a/4526286/836086
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
您要处理的问题很可能是您使用的请求解析器,而不是使用multipart/form-data
的表单,因为这两种编码均应由更高级别的代码平等处理.
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.
这篇关于在Extjs Form Submit中将文件上传为true时对表单数据进行编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!