Data Types

Upload Widget: Getting Started

To install the Upload Widget, use this script tag:

<script src="https://js.upload.io/uploader/v3"></script>

Or install via NPM:

npm install uploader

To open the widget:

// import { Uploader } from "uploader";
const uploader = Uploader({ apiKey: "free" }); // Replace "free" with your API key.
uploader.open({ maxFileCount: 1 });

Full code example

1<html>
2 <head>
3 <script src="https://js.upload.io/uploader/v3"></script>
4 <script>
5 const uploader = Uploader({
6 apiKey: "free" // Replace "free" with your API key.
7 });
8 uploader.open({ maxFileCount: 1 }).then(
9 files => {
10 const fileUrls = files.map(x => x.fileUrl).join("\n");
11 const success = fileUrls.length === 0
12 ? "No file selected."
13 : `File uploaded:\n\n${fileUrls}`;
14 alert(success);
15 },
16 error => {
17 alert(error);
18 }
19 );
20 </script>
21 </head>
22 <body></body>
23</html>

See: Configuration — e.g. { maxFileCount: 1 }

Live preview

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: