ExtJS 6 Ajax File Upload Modern Toolkit

Posted By Vitaliy | June 24, 2017 | ExtJS 6.2.0
0 720
Uploading file with AJAX is possible since XMLHttpRequest Level 2 and FormData API.

Js Code

var file = s.getComponent().getFiles()[0],
     data = new FormData();

data.append('file', file);

Ext.Ajax.request({
   url: '/upload/files',
   rawData: data,
   headers: {'Content-Type':null}, //to use content type of FormData
   success: function(response){
   }
});