fine uploader - I would like to If file upload failure after retry to another url -
i have multiple vaults in diff location 1.upload1.abc.com 2.upload2.abc.com. post @ upload1.abc.com if file fails upload start whole process again post file upload2.abc.com
so file upload doesn't fail.even if 1 chunk fails again whole set uploaded next fallback url on runtime.
this interesting way handle failed uploads. there no way ensure 1.upload1.abc.com
up?
i react complete
event thrown fine uploader. if responsejson
has success
property not true
pop new endpoint of endpoints stack, issue setendpoint
call, , issue retry
call upload restarts so,
var original_endpoints = ['1.upload1.abc.com', '2.upload2.abc.com'] , endpoints = original_endpoints; var fu = new qq.fineuploader({ // ... other options cors: { expected: true // *must* cross-origin request }, request: { endpoint: endpoints.shift() // original endpoint attempted first }, callbacks: { oncomplete: function (fileid, filename, responsejson, xhr) { if (responsejson.success != true) { var endpoint = endpoints.shift(); if (endpoint !== undefined) { // changes endpoint *all* subsequent uploads this.setendpoint(endpoint); // or, change endpoint particular file failed // , try original endpoint again on next file, // this.setendpoint(endpoints, fileid); } else { // restart process setting endpoints queue // default. note may want handle error of // endpoints failing way, restarts process // , may result in infinite loop if endpoints down. endpoints = original_endpoints; this.setendpoint(endpoints.shift()); } this.retry(fileid); // retry upload } } } });
Comments
Post a Comment