2
createuploadurlを使用してビットマップイメージを正常に保存できます。私の問題は、後で画像を送るためにメールアドレスのパラメータを渡したいということです。助けを事前にAndroidとGoogle-app-engine createuploadURL - 追加パラメータ(メールアドレス)を渡す方法
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
//this comes up as null
if (req.getParameter("email") != null) {
this.email = req.getParameter(email);
}
Map<String, BlobKey> blobs = blobstoreService.getUploadedBlobs(req);
BlobKey blobKey = blobs.get("imageField");
resp.setContentType("text/plain");
}
ありがとう:サーブレットコードで
//Code for uploading image within android
//Now upload the image
ByteArrayOutputStream bao = new ByteArrayOutputStream();
mBitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
HttpPost httppost = new HttpPost(url);
HttpParams postParams = new BasicHttpParams();
postParams.setParameter("email", "[email protected]");
httppost.setParams(postParams);
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
byte [] ba = bao.toByteArray();
entity.addPart("imageField", new ByteArrayBody(ba, "myimage.jpg"));
httppost.setEntity(entity);
// Execute HTTP Post Request
response = httpclient.execute(httppost);
私は、電子メールのparamを取得しよう:ここ
は、私が使用しようとしたコードです。