Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the image data to post ? #1

Open
sgkalyans opened this issue Aug 1, 2018 · 2 comments
Open

how to get the image data to post ? #1

sgkalyans opened this issue Aug 1, 2018 · 2 comments

Comments

@sgkalyans
Copy link

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 ?

@Moreno97
Copy link
Member

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

@RayhanYulanda
Copy link

RayhanYulanda commented Aug 22, 2019

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})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants