Reputation: 4202
so as mentioned above I am uploading a file through ExtJs using Ext.form.field.file
. However, when I do it, it sends the following header Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
. This is causing issues on my back-end (ASP.NET) which thinking that HTML is expected is putting tags around the JSON causing problems when the response comes back (haven't gotten an answer how to fix this on the ASP.NET side Does anyone have any idea how to modify this header either when sending the request on the ExtJs side or in an ASP.NET controller?
Upvotes: 3
Views: 2268
Reputation: 15673
As Neil mentioned it actually is expecting HTML to return because it is using hidden iFrame to do its work. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Basic-method-hasUpload
Upvotes: 2
Reputation: 5275
You can specify the headers you want to send when you submit you form as follow:
your_form.submit({
url: 'file-upload',
method: 'POST',
headers: { Accept : 'what you want' },
success: ....
});
I didn´t tested but I´m pretty sure it works.
Upvotes: 0