1// Example with Expo / axios / buffer
2import { Buffer } from 'buffer' // import buffer
3
4const { base64 } = await Expo.ImagePicker.launchImageLibraryAsync({
5 base64: true
6})
7
8const url = await api.getUploadUrlFromS3() // from your own back-end server
9const result = await api.uploadAsync(url, new Buffer(base64, 'base64')) // upload it
10
11console.log(result) // DONE!
12
13[...]
14// api.js
15function upload(url, image) {
16 return axios.put(url, image, {
17 headers: { 'Content-Type': 'image/png' } // add Content-Type on header
18 })
19}