MCPcopy Create free account
hub / github.com/Lobos/react-ui / ajaxUpload

Function ajaxUpload

src/utils/upload.js:19–31  ·  view source on GitHub ↗
({url, name, cors, file, onProgress, onLoad, onError, withCredentials})

Source from the content-addressed store, hash-verified

17}
18
19function ajaxUpload({url, name, cors, file, onProgress, onLoad, onError, withCredentials}) {
20 let data = new FormData();
21 data.append(name, file);
22
23 let xhr = createCORSRequest('post', url, cors);
24 xhr.withCredentials = withCredentials;
25 xhr.upload.addEventListener('progress', onProgress, false);
26 xhr.onload = onLoad;
27 xhr.onerror = onError;
28 xhr.send(data);
29
30 return xhr;
31}
32
33module.exports = function (args) {
34 return ajaxUpload(args);

Callers 1

upload.jsFile · 0.85

Calls 1

createCORSRequestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…