Note that there are some explanatory texts on larger screens.

plurals
  1. POUser-Agent and Blackberry 6.0?
    primarykey
    data
    text
    <p>In my application for Blackberry OS 6.0 I am posting multiple image files using HttpConnection, here is what I am trying, </p> <pre><code> byte[] _dataToBePost = strPostData.getBytes(); String lineEnd = "\r\n"; String boundary = "----------------------------"; String boundaryStartBytes = "------------------------------\r\n"; byte[] startBytes = boundaryStartBytes.getBytes(); String boundaryEndBytes = "\r\n------------------------------\r\n"; byte[] endBytes = boundaryEndBytes.getBytes(); _httpConnection = (HttpConnection)Connector.open(url,Connector.READ_WRITE,true); // Set the request method and headers _httpConnection.setRequestMethod(HttpConnection.POST); _httpConnection.setRequestProperty("If-Modified-Since","29 Oct 1999 19:43:31 GMT"); _httpConnection.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0"); _httpConnection.setRequestProperty("Content-Language", "en-US"); if( PhotoToSend != null) //if(AttachPhotos._vctAccPhotos.size() &gt; 0) { String[] strAccidentPhoto = {"AccidentPhoto1", "AccidentPhoto2", "AccidentPhoto3", "AccidentPhoto4", "AccidentPhoto5"}; for(int i=0; i&lt;5; i++) { String header = "Content-Disposition: form-data; name=\"file1\";filename=\""+ "AccidentPhoto"+ i +".jpg"+ "\"" + lineEnd + "Content-Type: application/octet-stream"+lineEnd+lineEnd; byte[] composition = header.getBytes(); byte[] photoData = AttachPhotos.get(strAccidentPhoto[i]); if(photoData != null) { _outputStream.write(startBytes); _outputStream.write(composition); _outputStream.write(photoData); _outputStream.write(endBytes); } } } </code></pre> <p>in my code I am using User-Agent as Profile/MIDP-2.0 Configuration/CLDC-1.0. Is this making any problem to post multiple files? Or is there any another way to post the data. The code doesn't through any exception but is enable to post Image files only. What I am missing in my code? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload