Open asroboy opened 2 years ago
I had the same problem. The request response simply does not exist, as if it has remained in limbo. I tested using angular http and I didn't have the same problem.
Same problem here.
I have the same issue and was wondering if I did something wrong. I followed the instructions in the main readme and also https://github.com/silkimen/cordova-plugin-advanced-http/wiki/Web-APIs-required-for-Multipart-requests
Further I'm using capacitor and not Cordova, maybe this causes an issue?
I found the solution here : https://github.com/ionic-team/capacitor/issues/1564#issuecomment-538200971
In www/helpers.js I replaced:
var reader = new global.FileReader();
by:
const fileReader = new global.FileReader();
const zoneOriginalInstance = fileReader["__zone_symbol__originalInstance"];
var reader = zoneOriginalInstance || fileReader;
I hope it will work for you as well.
Hi @silkimen , Is it possible to include this fix in the next version? It's atm blocking for using multipart into Capacitor project. Thanks Kr
For those that are not capable to fork the plugin and need to erase the fileReader at a higher level, here's a snippet code :
export class ZoneJSFileReader extends FileReader {
set onload(cb: () => void) {
const instanceZone = (this as any)?.["__zone_symbol__originalInstance"];
if (instanceZone) {
instanceZone.onload = cb;
} else {
super['onlaod'] = cb;
}
}
public override readAsArrayBuffer(arrBuffer: Blob): void {
const instanceZone = (this as any)?.["__zone_symbol__originalInstance"];
if (instanceZone) {
instanceZone.readAsArrayBuffer(arrBuffer);
} else {
super.readAsArrayBuffer(arrBuffer);
}
}
}
And just erase it before doing your post operation
window.FileReader = ZoneJSFileReader;
request stucks when send file with serialize is 'multipart' and form data, not give any responds even after very long-long time here my example of use