Image upload to a database

Hello guys,please i
want to perform an image upload using cordova-file-transfer and camera-plugin but i dint know to to go about it

Do you already have everything configured the plugins, and the server to receive the file? I have a upload running I can show the example of with developed it


Yes i have already configured the server , i have perform an upload to a server but this time around i want to perform an upload into a database that will serve has user profile picture
I will really appreciate your help

What database are you working on?

for now i’m working on a localhost server … mysqli db

Why do you need to upload the “image” to the server? Would not it be easier to just upload the “PATH” path of the image? Please send more details about your project.

Sorry, for my bad english.

In this section of html I show a default image, and after uploading, I show the image that just uploaded

Sorry, i’l put pastebin


thanks , i will go through it

ok, this what the project is about;
it an app that allows users to login and sign up (for new users), in the process of a signing up a profile will be created for each users and all user have the privilege of updating their profile which also require the uploading of image
what i want to for every image upload that a user makes it will be sent to the database of table_name users
so whenever i want to display the image it will be displayed in respect with the user detail from the database ,

i hope it’s clearer now

then maybe you need to save the image and return the path, and save the device only the path, for when the user accesses, and upload that image where you need it.
This example I passed, only saves the image and returns some information, but I believe your best path would be this.

1 Like

sorry i don’t really understand what you’re really saying

1 Like

Reply to: @FashMuyhee.

I would do exactly what he said, but I would do it more or less that way.

""I would create an (‘your-back-end / uploads.php’), there I would do the whole process of writing to the database (MYSQL, POSTGREE, SQL, any …) and then I would use the return from my (‘your-back-end / uploads.php’) to get the path of the image on my server and display it to the user. “”

How to get the return of an ajax post?'seu-back-end/uploads.php',{
    },function (retorno) {

Remember that there are more events in the ()

success, error etc…

Check them out


As in the example I showed on line 49 and 50 this is the return of my upload function on the server. For the query follow the example of @JhowJhoe .
I do not know if you do not understand my English and it’s terrible, or the idea of ​​saving the way in the device, sorry…

1 Like

Excelente exemplo. @CesarBalzer.

1 Like

ok, that means the while be in the function that
performs the uploads

1 Like

@FashMuyhee it sends POST, GET, etc … requests to its back end.

In the backend you can receive several formats.

Do this your in file: seu-back-end/uploads.php

var_dump ($_POST);
var_dump ($_FILES);
var_dump ($_GET);


See the result, more infos.