We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static String getFilePathFromURI(Context context, Uri contentUri) { //copy file and send new file path String fileName = getFileName(contentUri); if (!TextUtils.isEmpty(fileName)) { //File copyFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileName); /** * BugFix: No permission After Android 10 ( Api 29), It will make a upload error * /storage/emulated/0/image-646b1008-1611-4fd9-9758-8cdc15f1021d3788506624350752213.jpg * 需要将上传文件的缓存放到私有缓存中,不要随意使用保护目录 */ File copyFile = new File( context.getExternalCacheDir().getAbsolutePath() + File.separator + fileName); FileUtils.copy(context, contentUri, copyFile); return copyFile.getAbsolutePath(); } return null; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: