Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 16
Registered: ‎08-11-2009
My Device: Not Specified

Upload file in Chunks Sample Code

Greetings,

 

I have been trying for awhile to upload large files to a webserver via the POST method.  Everything works great, but in some devices the upload fails as it can't upload the 1MB file within the 120 second timeout.

 

Therefore, I want to upload the file in chunks so that as long as I upload a chunk within the 120 second timeout I will be okay.  I am open to other solutions however.

 

This post has gotten me the closest, but I am having the same problems.  I upload the first chunk and then once I issue the out.flush() command it will close the connection.  I can't find a way to flush the buffered output without closeing the connection.  This post mentions the solution is to  "use SocketConnection write data to OutputStream and flush() would work. But only if Content-Length is calculated accurately and that server request is also correctly formatted."

 

Does anyone have any sample code or suggestions on how to do this?

 

It looks like the person in this post was trying to do what I want to do, but didn't have any luck either.

 

Thanks,

Jeff

 

Contributor
Posts: 27
Registered: ‎10-02-2010
My Device: Not Specified

Re: Upload file in Chunks Sample Code

Hi

it is an olad post, but have u managed to upload big files ?

if yes please share your knowledge

thx