在我的 android 应用程序中,我能够捕获图像并存储在 SD 卡中。我有一个选择按钮和复选框来选择图片。但我不知道如何将所选图像上传到 php 服务器以通过我的网站显示。代码发布在下面,请帮助说明如何上传这些选定的图像。谢谢
imageAdapter = new ImageAdapter();
imageAdapter.initialize();
imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);
imagegrid.setAdapter(imageAdapter);
final Button selectBtn = (Button) findViewById(R.id.selectBtn);
selectBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
final int len = imageAdapter.images.size();
int cnt = 0;
String selectImages = "";
for (int i = 0; i < len; i++) {
if (imageAdapter.images.get(i).selection) {
cnt++;
selectImages = selectImages
+ imageAdapter.images.get(i).id + ",";
}
}
if (cnt == 0) {
Toast.makeText(getApplicationContext(),
"Please select at least one image",
Toast.LENGTH_LONG).show();
} else {
selectImages = selectImages.substring(0,selectImages.lastIndexOf(","));
Intent intent = new Intent(MainActivity.this,
UploadQueue.class);
intent.putExtra("Ids", selectImages);
startActivityForResult(intent, UPLOAD_IMAGES);
}