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
Developer
Posts: 101
Registered: ‎05-11-2009
My Device: 9000

HTTP Upload problem

Hi,

 

I have a problem uploading files to the server. I used this article for making download code working:How To - Download large files using the BlackBerry Mobile Data System

 

The problem is with the file upload. I don't know how to make it work, what headers I should send to server ?

 

I tried to send "Range" header with a size of the packet, the server has responded with 206 for the first packet but failed with error 416 for next packets, so I am doing something wrong, but I can't find any information anywhere, how it should be done properly.

 

Please help.

Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: HTTP Upload problem

416 says  Requested Range Not Satisfiable.

What did you exaclty set?

 

My guess:

I would assume that because upload is the other way around, you probably have to set Content-Range not Range!

Check HTTP documentation:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Highlighted
Developer
Posts: 101
Registered: ‎05-11-2009
My Device: 9000

Re: HTTP Upload problem

 

Thanks for reply, I tried setting both, Range, Content-Rage even Content-Length. Tried all the possible combinations, so I am lost now.

 

with Content-Range I tried to send data exactly as it is written in specification, here is from the code:

 

 c.setRequestProperty( "Content-Range" , "bytes " + rangeStart + "-" + rangeEnd + "/" + String.valueOf( fileSize ) );

 

which gives:

 

bytes 0-32767/211207

 

-> server responds with 200

 

bytes  32768-65535/211207

 

-> server responds with 200

 

bytes 65536-98303/211207

 

-> server responds with 200

 

bytes 98304-131071/211207

 

-> server responds with 200

 

bytes 131072-16389/211207

 

-> server responds with 200

 

bytes 163840-196607/211207

 

-> server responds with 200

 

bytes 196608-211206/211207

 

-> server responds with 200

 

Done.

 

But when I check the file on the server, only the last portion of it was upload - last 14Kb's

 

So what I am doing wrong here ?

 

 

Developer
Posts: 78
Registered: ‎12-03-2009
My Device: Not Specified

Re: HTTP Upload problem

Hey Dminator!

Did you figure out the solution? Could you share with us, just in case?

Regards,

--
Feel free to press the kudos button on the left side to thank the user that helped you.
Please mark posts as solved if you found a solution.