MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / uploadFiles

Function uploadFiles

apps/web/ui/ChannelView/ForumView/index.tsx:422–448  ·  view source on GitHub ↗
(files: File[])

Source from the content-addressed store, hash-verified

420 };
421
422 async function uploadFiles(files: File[]) {
423 setProgress(0);
424 setUploading(true);
425 setUploads([]);
426 const data = await getFormData(files);
427 return api
428 .upload(
429 { communityId: currentCommunity.id, data, type: 'attachments' },
430 {
431 onUploadProgress: (progressEvent: ProgressEvent) => {
432 const percentCompleted = Math.round(
433 (progressEvent.loaded * 100) / progressEvent.total
434 );
435 setProgress(percentCompleted);
436 },
437 }
438 )
439 .then(({ files }) => {
440 setUploading(false);
441 setUploads(files);
442 })
443 .catch((response) => {
444 setUploading(false);
445 setUploads([]);
446 return response;
447 });
448 }
449
450 function isPaginationView() {
451 return pathCursor && Number(pathCursor) > 0;

Callers 1

ChannelFunction · 0.70

Calls 2

getFormDataFunction · 0.90
uploadMethod · 0.65

Tested by

no test coverage detected