MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / handleFormDataUpload

Function handleFormDataUpload

packages/ui/src/ui-component/file/File.jsx:57–79  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

55 }
56
57 const handleFormDataUpload = async (e) => {
58 if (!e.target.files) return
59
60 if (e.target.files.length === 1) {
61 const file = e.target.files[0]
62 const { name } = file
63 const formData = new FormData()
64 formData.append('files', file)
65 setMyValue(`,filename:${name}`)
66 onChange(`,filename:${name}`)
67 onFormDataChange(formData)
68 } else if (e.target.files.length > 0) {
69 const formData = new FormData()
70 const values = []
71 for (let i = 0; i < e.target.files.length; i++) {
72 formData.append('files', e.target.files[i])
73 values.push(`,filename:${e.target.files[i].name}`)
74 }
75 setMyValue(JSON.stringify(values))
76 onChange(JSON.stringify(values))
77 onFormDataChange(formData)
78 }
79 }
80
81 return (
82 <FormControl sx={{ mt: 1, width: '100%' }} size='small'>

Callers 1

FileFunction · 0.85

Calls 2

stringifyMethod · 0.80
onChangeFunction · 0.50

Tested by

no test coverage detected