Java 通过android应用程序将图像上传到ftp服务器
嘿,我有一个Java 通过android应用程序将图像上传到ftp服务器,java,android,upload,ftp,imageview,Java,Android,Upload,Ftp,Imageview,嘿,我有一个android应用程序,可以从图库中选择一幅图像,并将其显示在ImageView上,我想将选择的图像上传到我的ftp服务器,我尝试使用SimpleFtp库,但它不起作用,所以我删除了它,我该怎么做 以下是加载图像的代码: public void loadImage(View view) { loadedImage = (ImageView)findViewById(R.id.upload_image1); Drawable drawable = loadedImage
android
应用程序,可以从图库中选择一幅图像,并将其显示在ImageView
上,我想将选择的图像上传到我的ftp服务器
,我尝试使用SimpleFtp
库,但它不起作用,所以我删除了它,我该怎么做
以下是加载图像的代码:
public void loadImage(View view)
{
loadedImage = (ImageView)findViewById(R.id.upload_image1);
Drawable drawable = loadedImage.getDrawable();
if(drawable.getConstantState().equals(getResources().getDrawable(R.drawable.camera_icon).getConstantState())) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "SelectPicture"), SELECT_PICTURE);
}
else
{
Intent i = new Intent(this, ShowImage.class);
i.putExtra("uri",selectedImageURI.toString());
startActivity(i);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
selectedImageURI = data.getData();
loadedImage = (ImageView)findViewById(R.id.upload_image1);
loadedImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
Glide.with(this).load(selectedImageURI)
.into((ImageView) findViewById(R.id.upload_image1));
}
}
}
使用api-2的最佳方式。
Try“我尝试过使用SimpleFtp库,但它就是不起作用”到底什么不起作用?您是否尝试调试它并找出问题所在?