Remove VM upload layer; keep file picker only
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
export function putToVm(file, url, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('PUT', url);
|
||||
xhr.timeout = options.timeoutMs || 300000;
|
||||
xhr.upload.onprogress = (event) => {
|
||||
if (event.lengthComputable && options.onProgress) {
|
||||
options.onProgress(Math.round(event.loaded / event.total * 100));
|
||||
}
|
||||
};
|
||||
xhr.onload = () => {
|
||||
if (xhr.status >= 200 && xhr.status < 300) resolve();
|
||||
else reject(new Error(`ВМ: HTTP ${xhr.status}`));
|
||||
};
|
||||
xhr.onerror = () => reject(new Error('Сеть (ВМ)'));
|
||||
xhr.ontimeout = () => reject(new Error('Таймаут загрузки на ВМ'));
|
||||
xhr.send(file);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user