You are probably running out of memory because the upload stream isn't uploaded by parts but instead the whole thing is stored until the upload is complete and then garbage collected. I have tried every available buffering solution but it isn't happening unless you use multipart.
If this is the error you are getting you will need to use multipart upload to get the whole thing uploaded. Search on google or stack on examples on how to do this. its not much different than using a http client, you will just need the http mime libraries from apache.
Here is a link that might help:
Multipart
Also apart from this limitation to not clearing the uploaded buffers until the upload is complete there is no limit to how much data you can transfer in a single request.