Click here to Skip to main content
15,886,199 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.
Posted
Updated 22-May-20 6: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 :)
 
Share this answer
 
Comments
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:

"http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/"

FATAL EXCEPTION: AsyncTask #1
Process: com.example.user.techweb, PID: 29489
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
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(ContentType.java:153)
at org.apache.http.entity.mime.MultipartFormEntity.(MultipartFormEntity.java:52)
at org.apache.http.entity.mime.MultipartEntityBuilder.buildEntity(MultipartEntityBuilder.java:226)
at org.apache.http.entity.mime.MultipartEntity.getEntity(MultipartEntity.java:119)
at org.apache.http.entity.mime.MultipartEntity.getContentLength(MultipartEntity.java:146)
at com.example.user.techweb.UploadActivity$UploadFileToServer.uploadFile(UploadActivity.java:170)
at com.example.user.techweb.UploadActivity$UploadFileToServer.doInBackground(UploadActivity.java:140)
at com.example.user.techweb.UploadActivity$UploadFileToServer.doInBackground(UploadActivity.java:118)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

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