menu search
brightness_auto
Ask or Answer anything Anonymously! No sign-up is needed!
more_vert
more_vert

I sure hope that you're a programmer and can write and understand coding. This is what it will take for you to upload a file from your Android device to a server. The coding is extremely long and will take time to write it. However, I did find this code online that you can use. Here is the link to the website and the code so that you can accomplish the task and write the batch file or coding necessary to do what you want to do. Android Upload File

9 Answers

more_vert
The very basic is that Android code is written in Java language. As with any programming language , we can use the File source, fetch the file object which in this case is a .txt file, that needs to be uploaded to the server. Before doing any further processing with the source file, make a check if the source file actually exists in the path, if not please skip and terminate.

If the source file does exist, allocate a new object of FileInputStream with the source file. Open a new network URL connection and set the content type, filename etc in the request parameters of this newly created request. Create the new data output stream and perform a file write, which will upload the file into the destination server.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert

Steps to Upload a Text file to server from Android:


  1. Place an Image on SD Card
  2. Place SD card image path and image name in Uploadtoserver
  3. Create a php script at server
  4. Place PHP script path in Uploadtoserver. 
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert

I hope this helps as well 


1. Go to settings in your phone. 

2. Go to files

3. Then view the downloads 

4: pick the correct file
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
1. Use the FTP protocol. An FTP client app like FileZilla can be used to upload the file from the Android device to the server.

2. Use an Android app that supports uploading files. Apps like Dropbox, Google Drive, and Box all support uploading files from Android to remote servers.

3. Use an online storage service. Services such as Amazon S3, Microsoft Azure, and Google Cloud Storage can be used to store and retrieve files from a remote server.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
To upload a text file to a server from an Android device, you can use libraries like Retrofit or Volley, create an HTTP request with the file as the request body, and send it to the server endpoint.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
1. Create an interface to allow the user to select the text file from their device.

2. Use an HttpURLConnection object to establish a connection to the server.

3. Open an OutputStream to the server and write the contents of the text file.

4. Add an InputStream to read the server response.

5. Close the connection when the upload is complete.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
As with any programming language , we can use the File source, fetch the file object which in this case is a .txt file, that needs to be uploaded to the server. Before doing any further processing with the source file, make a check if the source file actually exists in the path, if not please skip and terminate.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
Place an Image on SD Card

Place SD card image path and image name in Uploadtoserver

Create a php script at server

Place PHP script path in Uploadtoserver
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
If the source file does exist, allocate a new object of FileInputStream with the source file. Open a new network URL connection and set the content type, filename etc in the request parameters of this newly created request.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
Whenever you have a question in your mind, just drop it on Answeree. Help our community grow.
...