Using the dialog box I recognize the Uri file.
Intent i = new Intent().setType("*/*").setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(i, "Выбор файла"), 123); @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == 123 && resultCode == RESULT_OK) { Uri uri = data.getData(); .... File f = new File(uri.toString); // Далее с помощью OkHttp отправляю файл... } } In staktreys writes
java.io.FileNotFoundException: content: /com.android.providers.media.documents/document/image%3A10146 (No such file or directory)
If you replace uri.getPath() almost the same
java.io.FileNotFoundException: / document / image: 10146 (No such file or directory)
Given that the file that I open has the extension .png and a completely different name.