Android 需要将所选图像从SD卡发送到ASP.net web服务器
我需要将所选图像发送到web服务器。用于从中选择图像的代码 SD卡如下所示。我在谷歌上搜索过很多次。但仍然没有找到解决我问题的正确方法。有人可以建议我如何将所选图像发送到web服务器吗。web服务器是ASP.net web服务器。我找到了许多要发送的代码 将数据发送到internet上的php web服务器,但未找到要发送到ASP.net web服务器的代码。请帮帮我。我不熟悉安卓系统。所以我不知道发送图像的步骤/ 视频数据通过网络服务器传输Android 需要将所选图像从SD卡发送到ASP.net web服务器,android,asp.net,image,web-services,imageview,Android,Asp.net,Image,Web Services,Imageview,我需要将所选图像发送到web服务器。用于从中选择图像的代码 SD卡如下所示。我在谷歌上搜索过很多次。但仍然没有找到解决我问题的正确方法。有人可以建议我如何将所选图像发送到web服务器吗。web服务器是ASP.net web服务器。我找到了许多要发送的代码 将数据发送到internet上的php web服务器,但未找到要发送到ASP.net web服务器的代码。请帮帮我。我不熟悉安卓系统。所以我不知道发送图像的步骤/ 视频数据通过网络服务器传输 // I have added a button t
// I have added a button to select the image
Button imgbrowse=(Button)findViewById(R.id.imgbrowse);
imgbrowse.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
});
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
//the path where the image is located is stored in string variable
String picturePath = cursor.getString(columnIndex);
cursor.close();
//Displaying the selected image in the image view.
ImageView imageView = (ImageView) findViewById(R.id.imageView1);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
//Displaying the path of the selected image
TextView tv=(TextView)findViewById(R.id.textView5);
tv.setText(picturePath);
}
}
您可能还想看看这个: