MCPcopy Create free account
hub / github.com/error311/FileRise / uploadSingle

Function uploadSingle

public/js/sharedDropView.js:485–499  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

483 }
484
485 async function uploadSingle(item) {
486 const formData = new FormData();
487 appendCommonFormData(formData);
488 const rel = getRelativePathForItem(item.file);
489 if (rel !== item.file.name) {
490 formData.append('relativePath', rel);
491 }
492 formData.append('fileToUpload', item.file, item.file.name);
493
494 await xhrJson(uploadUrl, formData, function (evt) {
495 if (!evt.lengthComputable) return;
496 const pct = Math.min(100, Math.max(0, Math.round((evt.loaded / evt.total) * 100)));
497 setItemStatus(item, 'uploading', pct);
498 });
499 }
500
501 async function uploadChunked(item) {
502 const rel = getRelativePathForItem(item.file);

Callers 1

uploadItemFunction · 0.85

Calls 4

appendCommonFormDataFunction · 0.85
getRelativePathForItemFunction · 0.85
xhrJsonFunction · 0.85
setItemStatusFunction · 0.85

Tested by

no test coverage detected