I have a fileupload field in my from in Extjs application. Where I am trying to load files to the server by following code:
var form = Ext.getCmp(\'ProcImpNe
This is an improvement of cheftao answer.
If you need to work with different domains (e.g. localhost with a different port), follow these steps:
on the client side, before submitting the form, renew the document domain and then submit it with the form data:
document.domain = document.domain;
myForm.submit({
params: {
domain: document.domain
},
...
});
on the server side, respond with content-type text/html and with the following string (this example is done with ExpressJS):
var domain = req.body.domain,
script = '',
body = '' + JSON.stringify({success: true}) + '';
res.send('' + script + '' + body + '');
Update: 19/05/2016
Actually, the best solution is to do reverse proxy, avoiding this kind of problems.