Rumah > Soal Jawab > teks badan
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
三叔2016-11-09 10:52:23
params.put(file,new File(imagePath)里面具体贴下。”正确应该是image/png或者image/jpg“是图片格式,要转换成二进制流的方式上传,http://topmanopensource.iteye.com/blog/1605238