I’m trying to get started using Uppy. All of the examples either use dashboard, drag n drop, fileinput etc.
Is it possible to have an existing file input field trigger the uppy upload? I would prefer to style my own button that triggers a click on the file field or trigger uppy.
Basically, I want to use the functionality of Uppy core but without any of the UI elements so I can use my own.
Thanks!
Hi! Yes, it is possible. Just use Uppy’s API from the docs: https://uppy.io/docs/uppy/.
- Add a
<input type="file">
to you page, attach an event listener to it - When you get files, call
uppy.addFile({ data: fileBlob, name: 'name' })
. - Either set
autoProceed: true
so it starts uploading immediately, or calluppy.upload()
when you need to start the upload.