01-06-2010 07:16 AM
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.
01-06-2010 01:16 PM
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.
01-07-2010 04:25 AM
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 ?
04-16-2010 05:00 AM
Hey Dminator!
Did you figure out the solution? Could you share with us, just in case?
Regards,