Created
September 1, 2019 16:22
-
-
Save eldadfux/0b10ef3d3b42b35d961e813ecece715e to your computer and use it in GitHub Desktop.
Appwrite JS SDK - Upload Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var appwrite = new window.Appwrite(); | |
appwrite | |
.setEndpoint('https://localhost/v1') | |
.setProject('[PROJECT-ID]') | |
; | |
var file = document.getElementById('file-input').files[0]; | |
let read = ['*']; // wildecard read access | |
let write = ['user:self']; // write access only to me | |
appwrite.storage.createFile(file, read, write) | |
.then(function (response) { | |
console.log('file uploaded successfully'); | |
}, function (error) { | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment