Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:52:45+00:00 2026-06-09T11:52:45+00:00

In my android application, I am able to capture an image and store in

  • 0

In my android application, I am able to capture an image and store in SD card. I have a select button and check boxes to select pictures. But I don’t know how to upload the selected images to a php server to display via my website. Code is posted below, Please help by telling how to upload those selected images. Thank you

imageAdapter = new ImageAdapter();
imageAdapter.initialize();
imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);
imagegrid.setAdapter(imageAdapter);
final Button selectBtn = (Button) findViewById(R.id.selectBtn);
selectBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
  final int len = imageAdapter.images.size();
int cnt = 0;
  String selectImages = "";
                for (int i = 0; i < len; i++) {
                    if (imageAdapter.images.get(i).selection) {
                        cnt++;
                        selectImages = selectImages
                                + imageAdapter.images.get(i).id + ",";
                    }
                }
                if (cnt == 0) {
                    Toast.makeText(getApplicationContext(),
                            "Please select at least one image",
                            Toast.LENGTH_LONG).show();
                } else {
                    selectImages = selectImages.substring(0,selectImages.lastIndexOf(","));
                    Intent intent = new Intent(MainActivity.this,
                            UploadQueue.class);
                    intent.putExtra("Ids", selectImages);

                    startActivityForResult(intent, UPLOAD_IMAGES);
                }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:52:46+00:00Added an answer on June 9, 2026 at 11:52 am

    1) Create a webservice on your server

    2) convert your image to Base64 string in android

    3) send that string to the webservice by ksoap2

    4) convert back the string to image in webservice (You do not need to convert it to Image File if not needed)

    5) save it on hard disk of the server

    Edit:

    public static Bitmap base64ToBitmap(String strBase64) throws IOException {
            byte[] bitmapdata = Base64.decode(strBase64);
            Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata, 0,
                    bitmapdata.length);
            return bitmap;
        }
    
    public static String bitmapToBase64(Bitmap bitmap) {
            byte[] bitmapdata = bitmapToByteArray(bitmap);
            return Base64.encodeBytes(bitmapdata);
        }
    
    public static byte[] bitmapToByteArray(Bitmap bitmap) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        bitmap.compress(CompressFormat.PNG, 0 /* ignored for PNG */, bos);
        byte[] bitmapdata = bos.toByteArray();
        return bitmapdata;
    }
    

    or

        public static byte[] fileToByteArray(String path) throws IOException {
            File imagefile = new File(path);
            byte[] data = new byte[(int) imagefile.length()];
            FileInputStream fis = new FileInputStream(imagefile);
            fis.read(data);
            fis.close();
            return data;
        }
    
    
    public static String fileToBase64(String path) throws IOException {
            byte[] bytes = fileToByteArray(path);
            Base64.encodeBytes(bytes);
        }
    
    
    public static void base64ToFile(String path, String strBase64)
                throws IOException {
            byte[] bytes = Base64.decode(strBase64);
            byteArrayTofile(path, bytes);
        }
    
    public static void byteArrayTofile(String path, byte[] bytes)
                throws IOException {
            File imagefile = new File(path);
            File dir = new File(imagefile.getParent());
            if (!dir.exists()) {
                dir.mkdirs();
            }
            FileOutputStream fos = new FileOutputStream(imagefile);
            fos.write(bytes);
            fos.close();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application in which i have to store a bitmap
In my android application, I am able to write files to the sd card.
I have an Android application that writes data to the SD card. I want
I am trying to capture image and video from my android application with the
I have a android application to preview .dst file type,i am able launch the
I have an android application that was working great but 2 days ago things
I'm writing an Android application that I want to be able to send requests
I want to create an application for Android that will be able to scan
For one of the user is not able to download application from Android Play
My Android application was working in English and I have to provide the users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.