in react i want my file uploader consist of some file that fetch from server, then i can edit them and resend them to server
I know that this is a really old post, but I can still help.
The best way to do this would probably be to call the addFile
method on uppy after initializing it.
Here’s an example (using hooks)
const MyComponent = () => {
const uppy = React.useMemo(async () => {
// fetching image
const res = await fetch('my url')
const blob = await res.blob()
// Do all the configuration here
return Uppy()
.use(Transloadit, {})
.addFile({
name: 'my-file.jpg', // file name
type: 'image/jpeg', // file type
data: blob, // file blob
});
}, []);
React.useEffect(() => {
return () => uppy.close()
}, [])
return <DashboardModal uppy={uppy} />
}