Hi all, I am developing a MIDlet which allows the user to take a photo add some text and then upload it to a servlet.
My problem is with uploading.
I upload
an Integer
A string
size of photo byte[]array

I can upload the first 3 no problem but not all the bytes for the photo seem to be received by the servlet..

My code for the MIDlet is

String job_No = Integer.toString(upJobNo);
String picString = new String(upLoadImage);
int picSize = upPicture.length;
String size = Integer.toString(picSize);

String allData = job_No+"&"+upPicNotes+"&"+size+"&"+picString;
byte[] dataToSend = allData.getBytes();

String dataLength = Integer.toString(allData.length());

c = (HttpConnection)Connector.open(url2, Connector.READ_WRITE, true);
c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
"Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("content-type", "multipart/form-data; " );
c.setRequestProperty("Content-Length", dataLength);
c.setRequestProperty("Content-Language", "en-CA");

os = c.openOutputStream();



and my servlet code is....

int dataLength = request.getContentLength();

BufferedReader br = request.getReader();

String allData = "";

String data= "";
while((data = br.readLine()) != null)
allData = allData + data;

I then seperate the String into the individual parts again, and there is never the full bytes for the photo..
What am I doing worng??

also the request.getContentLength() returns -1.

Any help will be appreciated.
Thanks in advance.