# How to upload image to server through API

**URL:** <https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267>\
**Category:** ionic-v3\
**Created:** [April 18, 2018, 6:11pm UTC](https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267 "2018-04-18T18:11:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![visualarttech01](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/visualarttech01/32/118888_2.png) [@visualarttech01](https://forum.ionicframework.com/u/visualarttech01)\
**Post date:** [April 18, 2018, 6:11pm UTC](https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267/1 "2018-04-18T18:11:31Z")

</div>

i’m working on user registration form i have to send the data to API in JSON  
but i’m confused how to send the image.Finding a way to image uploading which works for both IOS and Android platform

---

<div class="post-metadata">

**Author:** ![DanielAccorsi](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danielaccorsi/32/118112_2.png) [@DanielAccorsi](https://forum.ionicframework.com/u/DanielAccorsi)\
**Post date:** [April 18, 2018, 6:17pm UTC](https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267/2 "2018-04-18T18:17:41Z")

</div>

The image data captured from camera can be sent to webservice.

```auto
this.camera.getPicture(options).then((imageData) => {

      let base64Image = 'data:image/jpeg;base64,' + imageData; 
      /* use base64Image above to show image in IMG tag, and use 'imageData' to send to your webservice */

    }, (err) => {
    });

```

---

<div class="post-metadata">

**Author:** ![visualarttech01](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/visualarttech01/32/118888_2.png) [@visualarttech01](https://forum.ionicframework.com/u/visualarttech01)\
**Post date:** [April 18, 2018, 11:07pm UTC](https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267/3 "2018-04-18T23:07:48Z")

</div>

i have to select it from the gallery for that i have used the ImagePicker Plugin i got the image  
now show i have to use Base64 Plugin to convert and send it to api

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:39pm UTC](https://forum.ionicframework.com/t/how-to-upload-image-to-server-through-api/128267/4 "2021-07-19T21:39:11Z")

</div>

Closed on July 19, 2021, 9:39pm UTC


