0

I have a bitmap

Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

and I want to send this bitmap to my server, like this

ftpclient.storeFile("myserverpath", myBitmap);

but I must send a file; I can't send a bitmap. Do I have to save this bitmap into a file on the phone and then load that file and send it? Or is there a simpler way to do this? I'm using Apache Commons for FTP. Thanks.

1 Answers1

0

Since .storeFile() accepts an InputStream and not a File, it's not necessary to save the Bitmap first. Refer to this answer to get an InputStream from a Bitmap.

Community
  • 1
  • 1
Krylez
  • 17,414
  • 4
  • 32
  • 41