I\'m trying to post a bitmap to a server using Android
and Retrofit
.
Currently I know how to post a file, but I\'d prefer to send a bitmap dir
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
you can convert your bitmap into a byte array and then after post this byte array into the server else you can make one tempory file for example
File file = new File(this.getCacheDir(), filename);
file directly uplaod into the server