12-30-2010 02:31 AM - edited 12-30-2010 02:38 AM
Am using the following code to upload image to server (php)
... c.setRequestProperty("Content-Type", "image/jpeg"); c.setRequestMethod(HttpConnection.POST); c.setRequestProperty("multipart", "form-data"); c.setRequestProperty("Connection", "Keep-Alive"); c.setRequestProperty("Content-Length", String.valueOf(theByteArray.length)); DataOutputStream printout = new DataOutputStream (c.openOutputStream()); printout.write(theByteArray); InputStream is = c.openInputStream(); int response = c.getResponseCode(); ...
This is working fine when I scale down the image to 40 X 40.
But when I try to upload the original image, it throws "java.io.InterruptedIOException: Local connection timed out after ~ 120000" exception.
I tried changing 120000 limit to 360000 using ";ConnectionTimeout=360000" .. it either throws the same exception with 360000 instead of 120000 or a new exception "java.io.IOException: Failed to transmit"
I guess increasing the connectiontimeout is not helping. Any suggestions on how I can make this work?
01-05-2011 11:17 AM
What BlackBerry Smartphone model and BlackBerry device software version are you testing on? You can find this under Options, About on the BlackBerry Smartphone.
What is the size of the images that are failing to upload? What transport route is being used for the connection?
03-28-2011 04:35 PM
188.8.131.52 is the version of the simulation software. What BlackBerry device software is running within that?
What transport route are you using when sending your data?
03-29-2011 01:19 PM
You'll be limited to about 256KB (the default maximum number of KB per connection) with those versions. Are you trying to upload data larger than that?
04-05-2011 03:33 PM
You can increase the value from 256 KB to 1024 KB in the MDS-CS Simulator, but note that it means that users would need this value increased on their BlackBerry Enterprise Server.
HTTP 413 Request Entity Too Large
An alternative is to upload the file in chunks or to use a different transport route.
Different ways to make an HTTP or socket connection
Download large files using the BlackBerry Mobile Data System (You would need to do the opposite of this).