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
Contributor
AJBerry
Posts: 22
Registered: ‎11-23-2010
My Device: Not Specified

Uploading image timed out for large files

[ Edited ]

Hi,

 

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?

 

Thanks

Please use plain text.
Administrator
MSohm
Posts: 14,512
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Uploading image timed out for large files

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?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Contributor
AJBerry
Posts: 22
Registered: ‎11-23-2010
My Device: Not Specified

Re: Uploading image timed out for large files

I am working on BlackBerry Device Simulator 2.6.0.49 (8100)

Please use plain text.
Administrator
MSohm
Posts: 14,512
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Uploading image timed out for large files

2.6.0.49 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?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Contributor
AJBerry
Posts: 22
Registered: ‎11-23-2010
My Device: Not Specified

Re: Uploading image timed out for large files

Device software is 4.2.189

Am using normal http request with ;deviceside=false

Please use plain text.
Administrator
MSohm
Posts: 14,512
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Uploading image timed out for large files

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?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Contributor
AJBerry
Posts: 22
Registered: ‎11-23-2010
My Device: Not Specified

Re: Uploading image timed out for large files

Yes. Am trying to upload images from device.

Is it possible to achieve this for image size > 256KB?

Please use plain text.
Administrator
MSohm
Posts: 14,512
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Uploading image timed out for large files

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

http://supportforums.blackberry.com/t5/Java-Development/HTTP-413-Request-Entity-Too-Large/ta-p/44598...

 

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

http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-con...

 

Download large files using the BlackBerry Mobile Data System (You would need to do the opposite of this).

http://supportforums.blackberry.com/t5/Java-Development/Download-large-files-using-the-BlackBerry-Mo...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.