So, it sounds like you have a Bitmap object. I assume you have some
server (http maybe?) set up to upload it to. Here's some code I use
for doing this:

        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod("http://your_server/path/to/upload/
script");
        Part[] parts = {
                new FilePart("pictureFile", new 
ByteArrayPartSource("pictureFile",
getBytes(bitmap))),
        };
        method.setRequestEntity(new MultipartRequestEntity(parts,
method.getParams()));
        client.executeMethod(method);
        response = method.getResponseBodyAsString();
        method.releaseConnection();

And getBytes(Bitmap):

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        bitmap.compress(CompressFormat.PNG, 80, output);
        return output.toByteArray();


On Mar 25, 11:02 pm, Ken <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I've followed this link and I know how to upload a file to a 
> server:http://www.anddev.org/upload_files_to_web_server-t443-s30.html
>
> However, let's say I've a Bitmap that I've received from the web, and
> I want to upload it to a server. Is there any ways to upload the
> Bitmap directly without first saving it as a file?
>
> Based on the link above, I think I just need to get the
> FileInputStream from the Bitmap. But I don't know how ...
>
> Thanks!
>
> Ken
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to