1
0
Fork 0
mirror of synced 2024-05-16 10:42:34 +12:00
appwrite/docs/examples/0.12.x/client-apple/examples/storage/create-file.md
2022-01-04 12:53:40 +01:00

535 B

import Appwrite

func main() { let client = Client() .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID

let storage = Storage(client)
storage.createFile(
    fileId: "[FILE_ID]",
    file: File(name: "image.jpg", buffer: yourByteBuffer)
) { result in
    switch result {
    case .failure(let error):
        print(error.message)
    case .success(let file):
        print(String(describing: file)
    }
}

}