To install the React Upload Widget via NPM:
npm install react-uploader
To install via YARN:
yarn install react-uploader
To install via a script tag:
<script src="https://js.upload.io/react-uploader/v3"></script>
1// Installed by "react-uploader".2import { Uploader } from "uploader";3import { UploadButton } from "react-uploader";4
5// Initialize once (at the start of your app).6const uploader = Uploader({ apiKey: "free" }); // Replace "free" with your API key.7
8const MyApp = () => (9 <UploadButton uploader={uploader}10 options={{ multi: true }}11 onComplete={files => alert(files.map(x => x.fileUrl).join("\n"))}>12 {({onClick}) =>13 <button onClick={onClick}>14 Upload a file...15 </button>16 }17 </UploadButton>18)
Props: uploaderchildrenoptions?onComplete?
Callback Parameter: Result
Options: Configuration
Live preview:
1// Installed by "react-uploader".2import { Uploader } from "uploader";3import { UploadDropzone } from "react-uploader";4
5// Initialize once (at the start of your app).6const uploader = Uploader({ apiKey: "free" }); // Replace "free" with your API key.7const uploaderOptions = {8 multi: true,9
10 // Comment out this line & use 'onUpdate' instead of11 // 'onComplete' to have the dropzone close after upload.12 showFinishButton: true,13
14 styles: {15 colors: {16 primary: "#377dff"17 }18 }19}20
21const MyApp = () => (22 <UploadDropzone uploader={uploader}23 options={uploaderOptions}24 onUpdate={files => console.log(files.map(x => x.fileUrl).join("\n"))}25 onComplete={files => alert(files.map(x => x.fileUrl).join("\n"))}26 width="600px"27 height="375px" />28)
Props: uploaderoptions?onUpdate?width?height?
Callback Parameter: Result
Options: Configuration
Live preview:
This website uses cookies. By continuing you are consenting to the use of cookies per our cookie policy.
This website requires a modern web browser -- the latest versions of these browsers are supported: