upload()
Uploads a file to an existing bucket.
- Javascript
- Go
- PHP
// from client
const file = event.target.files[0];
const { data, error } = await kontenbase.storage.upload(file);
// from server
const file = req.files[0];
const { data, error } = await kontenbase.storage.upload(
file.buffer,
file.originalname,
);
Response
Name | Type | Description |
---|---|---|
res.data | object | Response for data |
res.status | number | Response for status code |
res.statusText | string | Response for status message |
res.error | object | Response for error occurred |
file, err := os.Open("your_file.txt")
if err != nil {
return err
}
defer file.Close()
resp, err := client.Storage.Upload(file)
Response
Name | Type | Description |
---|---|---|
resp.Data | Storage | Response for data |
resp.Status | int | Response for status code |
resp.StatusText | string | Response for status message |
$file = fopen('/path/to/file', 'r');
$res = $kontenbase->storage->upload($file);
Response
Name | Type | Description |
---|---|---|
$res['data'] | object | Response for data |
$res['status'] | integer | Response for status code |
$res['statusText'] | string | Response for status message |
$res['error'] | object | Response for error occurred |
note
- Default bucket used is Kontenbase project id