MCPcopy Create free account
hub / github.com/ShipSecAI/studio / handleFileUpload

Function handleFileUpload

frontend/src/components/workflow/RunWorkflowDialog.tsx:61–80  ·  view source on GitHub ↗
(inputId: string, file: File)

Source from the content-addressed store, hash-verified

59 }, [initialValues, open]);
60
61 const handleFileUpload = async (inputId: string, file: File) => {
62 setUploading((prev) => ({ ...prev, [inputId]: true }));
63 setErrors((prev) => ({ ...prev, [inputId]: '' }));
64
65 try {
66 const formData = new FormData();
67 formData.append('file', file);
68
69 const fileData = await api.files.upload(file);
70 setInputs((prev) => ({ ...prev, [inputId]: fileData.id }));
71 } catch (error) {
72 console.error('File upload failed:', error);
73 setErrors((prev) => ({
74 ...prev,
75 [inputId]: error instanceof Error ? error.message : 'Upload failed',
76 }));
77 } finally {
78 setUploading((prev) => ({ ...prev, [inputId]: false }));
79 }
80 };
81
82 const handleInputChange = (inputId: string, value: unknown, type: RuntimeInputType) => {
83 setErrors((prev) => ({ ...prev, [inputId]: '' }));

Callers 1

renderInputFunction · 0.70

Calls 3

uploadMethod · 0.80
errorMethod · 0.80
appendMethod · 0.65

Tested by

no test coverage detected