We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0d1552d + ce33333 commit 8b07493Copy full SHA for 8b07493
packages/webui/src/client/lib/Components/Base64ImageInput.tsx
@@ -20,10 +20,17 @@ export function Base64ImageInputControl({
20
const { t } = useTranslation()
21
22
const handleSelectFile = useCallback(
23
- (fileContent: string) => {
24
- if (typeof fileContent !== 'string' || !fileContent) return
+ (_fileContent: string, file: File) => {
+ if (!file) return
25
26
- handleUpdate(fileContent)
+ const reader = new FileReader()
27
+ reader.readAsDataURL(file)
28
+ reader.onload = () => {
29
+ handleUpdate(reader.result as string)
30
+ }
31
+ reader.onerror = (error) => {
32
+ console.error('Error reading file:', error)
33
34
},
35
[handleUpdate]
36
)
0 commit comments