0
votes

I have an API that stores the image in the database.

"https://www.induskargha.com/index.php/api/upload-video" this is my API.

I should have to use the camera plugin to get the image from the gallery or directly from the camera. When I am using this plugin, it returns me either the base64 or the FILE_URL or the NATIVE_URl. When I am passing any of the three to the API, then API saves the image to null, But when I am using the API in the postman, it works well.

parameter for the API:-

image: ImageData(file), type: 'image',(string) name: 'user's name'(string, mobile: 4635643732, (number), artistType: 'artisans' (string)

PLEASE HELP ME. I am stuck in this problem for the past 5 days.

1
Add some code snippets. You should be more specific with your tags. Reading this I have no idea what is going on because I do not know what API & DB you are trying to use without following the link etc. - El Dude
induskargha.com/index.php/api/upload-video this is my API, and image: ImageData(file), type: 'image',(string) name: 'user's name'(string), mobile: 4635643732 (number), artistType: 'artisans' (string) these are the required parameters for the API - Aman Gupta

1 Answers

1
votes

You can convert the image file to base64 and post to your server using POST method.

let base64Image = 'data:image/jpeg;base64,' + imageData;

On your server side access that file form post data and upload that base64 file according to your server side language.

This is basically an easy process to upload files and images.