Upload image from android app , save it to sql sever - android

i want to build an andoid app , which will upload the image to sqlserver
i know how to save using ftp server,but i dont want to do in that way
is there any way that i can save directly to sql server
Thanks for your time guys

If you really need to save files in the database SQL server has a column type varbinary for saving BLOB objects.
http://msdn.microsoft.com/en-us/library/ms188362.aspx

You can do it by BASE64 encoding, you will obtain a string that you'll can store it into a TEXT field in your SQL DB.
And when you want to read or view the image, you'll have only to decode the string.
Here I give you a very good tutorial of how to encode

Related

Image storing in SQL DB from Android

I would like to create an application which accepts image in android convert it to base64string. The resulting base64 string will be sent to the rest API where it is converted to byte array and store in SQL DB. Is this the best possible way to store image in SQL DB or there any other possibilities?
Better practice is to store the string of the location on the filesystem where the service that executes your database call is hosted. When you retrieve the 'image' you retrieve the location and use that to pull back the image from the file system rather than storing the entire binary on the database.
This is My way , I will just say in simple way .first i create global path like "yourpath/"
then I Get image from server and Store it in device storage in the global path
then I Store only image name like imagename.jpg to the sqlite
at last I use image name stored in sqlite and concatenate with global path to display images whenever I want

Android: How can I save an image as a MySQL BLOB?

I have a problem with saving an image as a BLOB to MySQL. I only know the HttpURLConnection method, and I don't know how to make it accept byte[]. I can however send string to MySQL tables. But I don't know how to send Android image. I want to save it as a BLOB.

send images from remote server to mobile

I have a web platform in which the user enters the data, which are stored in SQL database. Using restful services and json I send the data in my mobile application via http calls, and I save them in sqlite database. The above works perfect. Now I want to upload images in web platform (which will saved in a separate table in SQL server) and in continue I want to get the images in mobile app, in the way which I have done for other data. After a lot research in google I found the blob data type. So , if I save the images as blob in sql then how can I convert them as json objects? Moreover, I want to know if it is efficient.
two ways to do that ( Base64 and byteArray ) by using Gson or Jackson, your byteArray shall automatically be converted to string if the variable is declared as string.

uploading image file to server

I try to find way to send picture from android gallery to online database server such as mySQL , but I think I should upload this IMAGE file first to server after that getting the direct image link and send this link to database mysql
any one have simple idea about that ?
You could for example encode the image in Base64, and then send it to your backend parsed as JSON via rest webservices, and store it in a BLOB field.

I would like to store images of users in the server. (Android)

I would like to have the user's name and a picture. But I cannot find a way to upload it on a table in mysql, so I guess that it is not good for the size.
I found that is it good to store it in localhost. So it wouldn't be in a table, but in the localhost.
I am using php my admin, is there any simple way or tutorial to store it?
thanks
I suppose you want to upload images to server running on localhost ,in order
to save an image in database table you have to use blob type if you are using mysql for example.
there are many tutorial available try this :
http://androidexample.com/Upload_File_To_Server_-_Android_Example/index.php?view=article_discription&aid=83&aaid=106
The easiest way is around this is to convert your image base64 format then save in in mysql. You can upload the image to server > let server do conversion, then save to mysql.
See Here http://davidwalsh.name/data-uri-php
courtesy of David Walsh, the owner of the site above:
// A few settings
$image = 'cricci.jpg';
// Read image path, convert to base64 encoding
$imageData = base64_encode(file_get_contents($image));
// Format the image SRC: data:{mime};base64,{data};
$src = 'data: '.mime_content_type($image).';base64,'.$imageData;
// Echo out a sample image
echo '<img src="',$src,'">';

Categories

Resources