Ionic upload image?

Hi I have a laravel website with restful services.

Then i used my ionic app to connect to my laravel website via restful api.

I wonder how my ionic mobile app upload image to my laravel directory?

I tried uploading before from my mobile app to database of course we have respected api for that and convert the image into based64. which i dont like because its slow my mysql database.

I wonder anyone already tried this?
is it possible angular or ionic upload image to my laravel or web directory via restful api?

Check this tutorial, hope it helps

1 Like

Get the file path after taking the picture and directly use and
in the below funcation.

upload() {
let options: FileUploadOptions = {
fileKey: ‘file’,
fileName: ‘name.jpg’,
headers: {}

}

fileTransfer.upload(’’, ‘’, options)
.then((data) => {
// success
}, (err) => {
// error
})
}

You can use https://ionicframework.com/docs/native/file-transfer/

1 Like

thanks for this i will try this one…

1 Like