小编Ath*_*lon的帖子

Android 在使用 Retrofit multipart 上传图像时遇到问题?

我在尝试使用改造将图像上传到服务器时遇到以下错误,api 接收标头授权令牌,_method = "put" 和 image = "imageName.jpg" 作为参数,其他所有内容都是可选的,任何帮助将不胜感激。

java.io.FileNotFoundException:/storage/emulated/0/Download/space-wallpaper-21.jpg:打开失败:EACCES(权限被拒绝)

userImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            galleryIntent.setType("*/*");
            startActivityForResult(galleryIntent, RESULT_LOAD_IMG);
        }
    });

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) {

        // Get the Image from data
        Uri selectedImage = data.getData();
        String[] filePathColumn = {MediaStore.Images.Media.DATA};

        // Get the cursor
        Cursor cursor = getContentResolver().query(selectedImage,
                filePathColumn, null, null, …
Run Code Online (Sandbox Code Playgroud)

java android android-studio retrofit retrofit2

0
推荐指数
1
解决办法
2523
查看次数

标签 统计

android ×1

android-studio ×1

java ×1

retrofit ×1

retrofit2 ×1