<html>
<head>
<script src="https://js.bytescale.com/upload-widget/v4"></script>
</head>
<body>
<div id="my-container"
style="position: relative; margin: 0 auto; width: 80%; height: 350px;">
</div>
</body>
</html>
// ---------------------------
// Configuration
// See: https://www.bytescale.com/docs/upload-widget#configuration
// ---------------------------
const options = {
apiKey: "free", // Get API keys from: www.bytescale.com
maxFileCount: 10,
layout: "inline",
container: "#my-container",
// Alternative setup:
// showFinishButton: false,
// onUpdate: (event) => console.log(JSON.stringify(event))
showFinishButton: true
};
Bytescale.UploadWidget.open(options).then(
files => alert(files.length === 0
? "No files selected."
: `Files uploaded:\n\n${files.map(x => x.fileUrl).join("\n")}`),
error => alert(error)
);