Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // img
- // {
- // uri: '"assets-library://asset/asset.JPG?id=SOME_ID&ext=JPG"',
- // md5: "some md5"
- // }
- // copy into cache dir first
- const path = FileSystem.cacheDirectory + img.md5
- await FileSystem.copyAsync({
- from: img.uri,
- to: path
- })
- // read that and do upload
- const file = await FileSystem.readAsStringAsync(path, {
- encoding: FileSystem.EncodingTypes.Base64
- })
- const payload = {
- title: 'some awesome photo',
- image: file
- }
- fetch('somewhere', {
- method: 'POST',
- body: JSON.stringify(payload)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement