I want to upload a file using Ext.Ajax.request
. Therefore I add the id of the file-input-field (form: formId
). I also want to add some headers (Accept
, Authorization
, ...) to the request, which works when I don't add the form
parameter. However when the form parameter is set my headers will be ignored for whatever reason.
I use ExtJs 6.2 modern.
How can I add headers when a form parameter is set to the request?
Ext.Ajax.request({
cors: true,
useDefaultXhrHeader: false,
method: 'POST',
url: someUrl,
headers: {
'Accept': 'application/json',
'Authorization': someString,
'usertoken': someString
},
params: {
name: fileName,
override: false
},
isUpload: true,
form: formId
})