xxtommoxx
xxtommoxx

Reputation: 309

Extjs Multipart/Post Request Same Form

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 event handler, but it does not work. Any ideas? thanks

Upvotes: 0

Views: 1062

Answers (1)

Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

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?

Upvotes: 1

Related Questions