Appwrite companion cookbook
The snippet creates a new promise from the SDK Storage class for appwrite. The first argument is the name of the file, the second argument is the file's ID, and the third argument is the document element's uploader attribute. The promise is then resolved when the user clicks the file's link.
let promise = sdk.storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files);