Upload file in Retrofit 2

后端 未结 4 1814
谎友^
谎友^ 2020-12-29 12:35

I tried the following but on response i am getting 500 error (Internal Server Error) -- help me design the interface for the request in the above screenshot...thank

4条回答
  •  佛祖请我去吃肉
    2020-12-29 13:20

        public String getRealPathFromURI(Context context, Uri contentUri) {
        Log.d("imin", "onClick: in image conversion");
    
        Cursor cursor = null;
        try {
            String[] proj = {MediaStore.Images.Media.DATA};
            cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToFirst();
            Log.d("imin", "onClick: in image conversion try");
    
            return cursor.getString(column_index);
        } finally {
            Log.d("imin", "onClick: in image conversion finally");
    
            if (cursor != null) {
                cursor.close();
            }
        }
    }
    

提交回复
热议问题