Data Types

Get Started

Bytescale simplifies file uploading, file processing, content optimization, and content delivery.

To upload files with Bytescale's Upload Widget:

1<html>
2 <head>
3 <script src="https://js.bytescale.com/upload-widget/v4"></script>
4 <script>
5 // -----
6 // Configuration:
7 // https://www.bytescale.com/docs/upload-widget#configuration
8 // -----
9 const options = {
10 apiKey: "free", // Get API key: https://www.bytescale.com/get-started
11 maxFileCount: 1
12 };
13
14 // import * as Bytescale from "@bytescale/upload-widget";
15 Bytescale.UploadWidget.open(options).then(
16 files => {
17 const fileUrls = files.map(x => x.fileUrl).join("\n");
18 const success = fileUrls.length === 0
19 ? "No file selected."
20 : `File uploaded:\n\n${fileUrls}`;
21 alert(success);
22 },
23 error => {
24 alert(error);
25 }
26 );
27 </script>
28 </head>
29 <body></body>
30</html>

Or with NPM:

npm install @bytescale/upload-widget
import * as Bytescale from "@bytescale/upload-widget";
// -----
// Configuration:
// https://www.bytescale.com/docs/upload-widget#configuration
// -----
const options = {
apiKey: "free", // Get API key: https://www.bytescale.com/get-started
maxFileCount: 1
};
Bytescale.UploadWidget.open(options).then(
files => {
const fileUrls = files.map(x => x.fileUrl).join("\n");
const success = fileUrls.length === 0
? "No file selected."
: `File uploaded:\n\n${fileUrls}`;
alert(success);
},
error => {
alert(error);
}
);

The Upload Widget (our ready-made UI component) supports these web frameworks:

The JavaScript SDK (our headless library) supports browsers & Node.js:

Learn more about downloading and processing files:

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: