1
0
Fork 0
mirror of synced 2024-09-19 19:07:21 +12:00
appwrite/docs/examples/0.14.x/client-web/examples/storage/create-file.md

14 lines
403 B
Markdown
Raw Normal View History

2022-05-13 07:35:35 +12:00
const sdk = new Appwrite();
sdk
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
let promise = sdk.storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]);
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});