How to upload image from Android device to Rails server? - android

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.

Related

How to send a bitmap from Android Studio to WebService (asp.net api controller)

In my Android Studio app I can take pictures which are saved in a bitmap.
This bitmap I want to send to my web service (asp.net c#) so that I can save it there.
I am working with retrofit and until now I was able to send my Complex datatype (Info) to my Controller.
Now the only way I see to send my bitmap to my web service is to convert it to a String which I did like this:
How to convert a Base64 string into a BitMap image to show it in a ImageView?
but now when I add the bitmap as string, my controller isnĀ“t reached anymore.
Even when I make it url conform. Any Idea why or if there is an other way to send a bimap?
You can use Image Upload library. See this link:
https://github.com/alexbbb/android-upload-service

How to upload a photo to a webservice using Xamarin Forms

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

Send image via json in android

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?

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.

Image Upload Using .net Webservices

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

Categories

Resources