In this tutorial, we demonstrate how to create a file upload form that allows site visitors to upload files to your site's Media Manager using the JavaScript SDK. Site visitors click the upload button to choose a file and then click the regular button to perform the upload.
Tip: For more complex file upload scenarios, you can use the Media API.
We'll use the following steps to build the file upload functionality:
Add the following elements to your page:
uploadButton.button.text.image.The form should look like this:

The upload button handles site visitors choosing the file. We'll add an onClick() function to make the regular button perform the actual upload.
To create the onClick() function:
onClick() event handler for the button:uploadFiles() async method, and then display the uploaded image and an appropriate message:Here's the complete code for your page: