Skip to content

About FIle Upload component, how to send file ? #3071

Answered by cschroeter
Asteb612 asked this question in Q&A
Discussion options

You must be logged in to vote

@Asteb612

Hey mate thanks for reaching out. The FileUpload component in Ark is primarily there to help your validate user input such as file size, type etc. Uploading a file to a server is something that happens on user land. for example here is how you could start:

import { FileUpload } from '@ark-ui/react/file-upload'

const Demo = () => {
  const handleFileAccept = (files: FileUpload.FileAcceptDetails) => {
    // send files to server
  }
  return (
    <FileUpload.Root onFileAccept={handleFileAccept} maxFiles={5}>
    // ...
    </FileUpload.Root>
    )
  }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Asteb612
Comment options

Answer selected by Asteb612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants