0

I have a text file on my android device. I need to send this text file from the Android to a web server, using an http request, displaying the content. Is that case for a stream? I don't know how to send the entire file

Simo
  • 45
  • 7

1 Answers1

0

Following code will help:

API 22: Using HttpClient and "binary/octet-stream"

How to send a file in Android from mobile to server using http?

API23: Using HttpUrlConnection

Sending files using POST with HttpURLConnection


Or, you can use Retrofit. It is powerful, robust, easy http library.

Tutorial: https://futurestud.io/blog/retrofit-how-to-upload-files

Community
  • 1
  • 1
Stanley Ko
  • 3,383
  • 3
  • 34
  • 60