Click here to Skip to main content
14,735,318 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi.. I want to capture an image from android device and I want to store it in mysql database.How I can do that?. I don't have any knowledge in creating database using mysql.
Please help me.
Thank you.

What I have tried:

I tried using WAMP but image is not uploading in database.
Updated 22-May-20 7:02am

1 solution

You need to create a service for the purpose of saving image in MySQL database.
There are many approaches through which you can get your job done. A google/bing search with some good keywords can yield 100s of good artcles on this topic.

However, for a step by step solution you can refer to following article which has proposed solution using PHP and MySQL-
Android Upload Image to Server Using PHP MySQL[^]

You can refer to the video tutorial too.
In case you find any difficulties while implementing this, please let me know with the details of the issue.

Hope, it helps :)
Member 12278307 6-Jul-16 6:11am
Thank you so much.How can I connect database using WAMP?

code using php is as below:
Member 12278307 6-Jul-16 6:35am
I got this exception while uploading. Please tell me to resolve this.
I used this link:


Process: com.example.user.techweb, PID: 29489
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(
at java.util.concurrent.FutureTask.finishCompletion(
at java.util.concurrent.FutureTask.setException(
at android.os.AsyncTask$SerialExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicHeaderValueFormatter; in class Lorg/apache/http/message/BasicHeaderValueFormatter; or its superclasses (declaration of 'org.apache.http.message.BasicHeaderValueFormatter' appears in /system/framework/org.apache.http.legacy.boot.jar)
at org.apache.http.entity.ContentType.toString(
at org.apache.http.entity.mime.MultipartFormEntity.(
at org.apache.http.entity.mime.MultipartEntityBuilder.buildEntity(
at org.apache.http.entity.mime.MultipartEntity.getEntity(
at org.apache.http.entity.mime.MultipartEntity.getContentLength(
at com.example.user.techweb.UploadActivity$UploadFileToServer.uploadFile(
at com.example.user.techweb.UploadActivity$UploadFileToServer.doInBackground(
at com.example.user.techweb.UploadActivity$UploadFileToServer.doInBackground(
at android.os.AsyncTask$
at android.os.AsyncTask$SerialExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900