ContentResolver cr = context.getContentResolver();
Cursor cur = cr.query(Media.EXTERNAL_CONTENT_URI, columns, null, null, null);
int photoPathIndex = cur.getColumnIndexOrThrow(Media.DATA);
String imagePath= cur.getString(photoPathIndex);
params.put(file,new File(imagePath);
然后上传到服务器后,文件类型是application/octet-steam-qgnY87ejQNY6ub0gpinv7klmM5u6J,正确应该是image/png或者image/jpg
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...