我是黑莓开发的新手,我必须将我的图像从设备库上传到服务器。我发现很多与这一点相关的链接。但我找不到这个问题的确切结果。我用了这个例子。使用此示例,我将值放入 Byte[] 但我无法使用此代码满足我的要求。因为我无法理解我们必须在代码中传递哪个 URL 以及哪些是参数。
我使用了另一种格式,我在这里发布了我的代码,使用它我得到了响应代码:200。但我无法解决这个问题
HttpConnection oCon = (HttpConnection)Connector.open("http://74.208.77.106/jm/testing/iDaddyapi.php;deviceside=true;interface=wifi");
oCon.setRequestMethod(HttpConnection.POST);
oCon.setRequestProperty("Content-Length", "" + imageByte.length);
URLEncodedPostData oPostData = new URLEncodedPostData(URLEncodedPostData.DEFAULT_CHARSET, false);
oPostData.append("api", "postidaddyimage");
oPostData.append("imagetype", "F");
oPostData.append("image", strImage);
OutputStream strmOut = oCon.openOutputStream();
strmOut.write(oPostData.getBytes());
strmOut.flush();
strmOut.close();
int rc = oCon.getResponseCode();
System.out.println("Response code.............."+rc);
if (rc != HttpConnection.HTTP_OK)
throw new IOException("Error response code: " + rc);
谁能帮我?我坚持这一点。
谢谢,曼西