Hi all.
I developed a app using MIDP exc.. The application is working 110% accept for one problem.. In my app i do a HTTP post to a url to get a picture. Now, this works fine but only on certain phones..I use a nokia 6680 and their is no prob,but when I try my friends new N80 for instance,the other data gets send through but the photo not..This is using gprs,when he uses he's WIFI to connect it works fine! Why is this, can it b my code,the network ,the phone itself or what?? I need to get this resolved asap for this project needs to get finished!
I have attached part of the html code,please advise me on meaby a stupit mistake or anything...
HttpConnection c = null;
HttpConnection htt = null;
DataInputStream dis = null;
DataInputStream is = null;
DataOutputStream os = null;
try {
String url1 = "http://XXX.php";
Form waiting = new Form("Connection");
waiting.append(new StringItem(null,"Connecting."));
display.setCurrent(waiting);
//I only do this get because someone once told me it may help..
c = (HttpConnection) Connector.open(url1);
c.setRequestMethod(HttpConnection.GET);
c.getResponseCode();
c.close();
c = (HttpConnection)Connector.open(url1);
c.setRequestMethod(HttpConnection.POST);
waiting.delete(0);
waiting.append("Connecting..");
c.setRequestProperty("User-Agent",
"Profile/MIDP-1.0 Confirguration/CLDC-1.0");
c.setRequestProperty("Accept_Language","en-US");
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
waiting.delete(0);
waiting.append("Connecting...");
os = c.openDataOutputStream();
String params;
params = "search=" + searchVar;
waiting.delete(0);
waiting.append("Connecting...");
os.write(params.getBytes());
waiting.delete(0);
waiting.append("Connecting.....");
StringBuffer sb = new StringBuffer();
int respCode = c.getResponseCode();
waiting.delete(0);
waiting.append("Connecting.........");
if (respCode == c.HTTP_OK) {
//StringBuffer sb = new StringBuffer();
//os = c.openOutputStream();
is = c.openDataInputStream();
waiting.delete(0);
waiting.append("Connecting............");
int chr;
while ((chr = is.read()) != -1)
sb.append((char) chr);
Please,any advise will be greatly appriciated!!!

Reply With Quote

