Skip to content

Instantly share code, notes, and snippets.

@AmyrAhmady
Created September 16, 2020 11:58
Show Gist options
  • Save AmyrAhmady/6be61a9ea48a07c0a92a7cdacac1463f to your computer and use it in GitHub Desktop.
Save AmyrAhmady/6be61a9ea48a07c0a92a7cdacac1463f to your computer and use it in GitHub Desktop.
let imageNumber = 1;
if (this.state.pic1 && this.state.pic1.uri) {
let obj = {
uri: this.state.pic1.uri,
type: this.state.pic1.type,
name: 'image.jpg',
};
formData.append('Pic' + imageNumber, obj);
imageNumber++;
}
if (this.state.pic2 && this.state.pic2.uri) {
let obj = {
uri: this.state.pic2.uri,
type: this.state.pic2.type,
name: 'image.jpg',
};
formData.append('Pic' + imageNumber, obj);
imageNumber++;
}
if (this.state.pic3 && this.state.pic3.uri) {
let obj = {
uri: this.state.pic3.uri,
type: this.state.pic3.type,
name: 'image.jpg',
};
formData.append('Pic' + imageNumber, obj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment