开发者

Extjs Multipart/Post Request Same Form

开发者 https://www.devze.com 2023-02-21 05:04 出处:网络
Is there a way in ExtJS to specify the type of request you want in one form. Say I have two buttons, one button does a multipart request and another does a simple post request.

Is there a way in ExtJS to specify the type of request you want in one form. Say I have two buttons, one button does a multipart request and another does a simple post request. I used this http://dev.sencha.com/deploy/dev/examples/form/file-upload.html for multipart request and tried setting the fileUpload flag on the button's eve开发者_运维技巧nt handler, but it does not work. Any ideas? thanks


My question is do you really need two ways to submit the form?

The multipart encoding should be used along with POST method only. Even if you don't have a file data in the form you can use POST & multipart encoding. On the server side, you will have to check if your form have any file upload present or not. Other form element data can be retrieved as usual.

You have to think of two methods of submit if you were using GET method to submit form data. In that case, you cannot use the multipart encoding. But in your case, you are using POST so, what stops you from using multipart even if you don't have the file data?

0

精彩评论

暂无评论...
验证码 换一张
取 消