Why are you reading the entire file into a byte array?
That sounds right there like the OutOfMem error.

public static byte[] getBytesFromFile(ContentResolver cR, String
fileUriString) throws IOException {
    Uri tempuri = Uri.parse(fileUriString);
    InputStream is = cR.openInputStream(tempuri);
    byte[] b3 = readBytes(is);
    is.close();
    return b3;
}

when you're about to do your multipart post just read a little, write
a little.
Buffer the sending process, you don't need to do multiple PUTs or
POSTS (and rewrite your webserver)

On Apr 8, 7:40 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Bob Kerns wrote:
> > I'm a bit puzzled why the other respondents didn't pick up this, maybe
> > I missed something in the discussion?
>
> > But anyway, the basic flaw in your strategy is reading it all into
> > memory at once. There's no need to do so, and that is ALWAYS going to
> > impose a limit on the size of file you can handle, on any platform.
>
> I didn't miss it. OTOH, I was trying to scope my response into something
> that didn't mess up the original plan too much and stuck to things I
> knew worked with HttpClient. And, as previously noted, I'm short on
> sleep. :-(
>
> > That has the fatal drawback that the camera will be tied up, and
> > possibly blocked, if the server is too slow -- which is likely.
>
> I'm reasonably certain the Uri being handed back from the Intent will be
> to a file handled by the MediaStore, not live off the camera.
>
> > I wonder why the multipart stuff was left out of the SDK?
>
> It's an oft-asked question with no known answer.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android 2.x Programming Books:http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to