I am Developing an Android Based Application. I am Using .net webservice to upload the data. Here I am successfully able to upload all the data except Image Byes. I want to know how to send Image as Binary array to the .net webservice.
I think you can convert images in the Base64 string and then its easy to upload string on the server.
Just check this question for code of Converting image to Base64 string
Related
I am trying to upload a photo to my data base using Xamarin forms. I have the image. How would I use HTTP Post to push it up to the web service?
Thanks
First: write code to covert your image to base64 string.
Second: Pass this string to your web service using HTTP Post.
third: in your web service write code to convert this base64 string to image.
fourth: store that image in your server directory
Hi I am working with android.I want to send an image from server to android and I had done it with sending url from server.How can I send an image from server to android app via json?? is it possible??
It is possible if you can convert your image at your server to a Base64 encoding string. Then you can send the string to your app via JSON.
You can use Apache Common IOUtils:
Base64.encode(FileUtils.readFileToByteArray(imageFile));
On your app you can convert the string to image, example in this link
How to convert a Base64 string into a BitMap image to show it in a ImageView?
Hope that helps
It is possible to send binary data within Json but you have to escape the binary data (UTF-8 encoding and use Base64.) This will increase the data size. Why not just include the path in JSON and fetch/load it?
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 have successfully send a string from android to .NET using HTTP GET, I am using WCF in the .NET end, my real intention is to send an image from android mobile to .NET server, can I use GET for this, ie, convert the image into base64 string and then send the image to .NET just like I did for the string? If no, why is it not possible?
GET would append the Base64 encoded string representation of the image to the URL. URLs have length limitations hence the entire string may not get transferred.
A better approach would be to use POST with JSON data to hold the Base64 encoded image string.
I am working on a Android project and want to upload Bitmap images to my rails server. But I have no idea how to write the Rails models or controllers.
I find someone using MultipartEntity post to upload images and paperclip to recieve images on RoR server. I want to know how to connect the post and server (what url?) and how to write the model or controller.
I use a stupid method. I convert the Bitmap image to byte array and use Base64 method to convert it to a string. Post the string to server. When I want to get image, download the string and convert it to Bitmap.