android上传图片到服务器的类型是application/octet-steam-......是什么原因?

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

阅读 2.3k
1 个回答

params.put(file,new File(imagePath)里面具体贴下。”正确应该是image/png或者image/jpg“是图片格式,要转换成二进制流的方式上传,http://topmanopensource.iteye...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题