mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
Document from.upload() and from.update() workaround for React Native
This commit is contained in:
1 parent
a8492e8137
commit
ffdde846aa
1 file changed
+26
@@ -986,6 +986,7 @@ pages:
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `insert`
|
||||
- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.
|
||||
examples:
|
||||
- name: Upload file
|
||||
isSpotlight: true
|
||||
@@ -1000,6 +1001,18 @@ pages:
|
||||
upsert: false
|
||||
})
|
||||
```
|
||||
- name: Upload file using `ArrayBuffer` from base64 file data
|
||||
js: |
|
||||
```js
|
||||
import {decode} from 'base64-arraybuffer'
|
||||
|
||||
const { data, error } = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.upload('public/avatar1.png', decode('base64FileData'), {
|
||||
contentType: 'image/png'
|
||||
})
|
||||
```
|
||||
|
||||
storage.from.update():
|
||||
title: 'from.update()'
|
||||
@@ -1008,6 +1021,7 @@ pages:
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `update` and `select`
|
||||
- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.
|
||||
examples:
|
||||
- name: Update file
|
||||
isSpotlight: true
|
||||
@@ -1022,6 +1036,18 @@ pages:
|
||||
upsert: false
|
||||
})
|
||||
```
|
||||
- name: Update file using `ArrayBuffer` from base64 file data
|
||||
js: |
|
||||
```js
|
||||
import {decode} from 'base64-arraybuffer'
|
||||
|
||||
const { data, error } = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.update('public/avatar1.png', decode('base64FileData'), {
|
||||
contentType: 'image/png'
|
||||
})
|
||||
```
|
||||
|
||||
storage.from.move():
|
||||
title: 'from.move()'
|
||||
|
||||
Reference in new issue
Block a user