MCPcopy Create free account
hub / github.com/dailydotdev/apps / handleFiles

Function handleFiles

packages/shared/src/components/fields/DragDrop.tsx:168–184  ·  view source on GitHub ↗
(files: FileList | null)

Source from the content-addressed store, hash-verified

166 const { validateFiles } = useFileValidation(validation, errorMessages);
167
168 const handleFiles = (files: FileList | null) => {
169 if (!files || files.length === 0) {
170 return;
171 }
172
173 const { validFiles, errors } = validateFiles(files);
174
175 if (errors.length > 0) {
176 const first = errors[0];
177 const fileName = first.file ? ` (${first.file.name})` : '';
178 displayToast(`${first.message}${fileName}`);
179 return;
180 }
181
182 setFilenames(validFiles.map((f) => f.name));
183 onFilesDrop(validFiles, errors.length > 0 ? errors : undefined);
184 };
185
186 const { input, openFileInput } = useFileInput({
187 inputRef,

Callers

nothing calls this directly

Calls 2

validateFilesFunction · 0.85
displayToastFunction · 0.85

Tested by

no test coverage detected