Get real path from URI of file in sdcard marshmallow

前端 未结 3 651
情深已故
情深已故 2020-12-01 17:33

I want to pick file that exist in sdcard not in internal storage and upload it server but I am not able to get its path for getting its size. I have start a

3条回答
  •  死守一世寂寞
    2020-12-01 17:53

    Change your upload code. Somewhere you will have

    FileInputStream fis = new FileInputStream(path);
    

    Change to

    InputStream is = getContentResolver().openInputStream(uri);
    

    So use the uri directly. No need for a file path.

提交回复
热议问题