RequestBody body = RequestBody.create(MediaType.parse("application/otcet-stream"),file);
MultipartBody.Part part = MultipartBody.Part.createFormData("image", file.getName(), body);
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Uri uri = data.getData();
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
} catch (IOException e) {
e.printStackTrace();
}
String path = Environment.getExternalStorageDirectory() + “/euyr”;
File file = new File(path);
if (!file.exists()) {
file.mkdir();
}
File file1 = new File(file,“123.png”);
try {
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file1));
bitmap.compress(Bitmap.CompressFormat.JPEG,100,bufferedOutputStream);
bufferedOutputStream.flush();
bufferedOutputStream.close();
} catch (Exception e) {
e.printStackTrace();
}