react-native-image-picker-form icon indicating copy to clipboard operation
react-native-image-picker-form copied to clipboard

how to get the image data to post ?

Open sgkalyans opened this issue 7 years ago • 2 comments

Hi there,

Thank you for the image picker form.

I want to get the selected image data to post in the API in order to store in database. May i know how to get the image data ?

sgkalyans avatar Aug 01 '18 15:08 sgkalyans

Hi @sgkalyans ! On the state object the image data it's saved, specifically on the field you provided the factory.

a-morenovalls avatar Aug 31 '18 07:08 a-morenovalls

you can use FormData() and just put the value in uri to send it to server.

const uriPhoto = this.state.value['image'];//value of image
const uriPart = uriPhoto.split('.');
const fileExtension = uriPart[uriPart.length - 1];
data.append('photo',{uri: uriPhoto, type: 'image/'+fileExtension, name: 'photo'+'.'+fileExtension})

RayhanYulanda avatar Aug 22 '19 06:08 RayhanYulanda