Android Upload Video to Server using PHP

Many peoples requested me to write a tutorial to upload video to server. So in this android upload video to server tutorial we will learn how we can upload video from android gallery to  our web server. …

android upload video to server

Many peoples requested me to write a tutorial to upload video to server. So in this android upload video to server tutorial we will learn how we can upload video from android gallery to  our web server.

For this tutorial I will be using Hostinger’s fee web hosting server.

Some peoples also asked me about a tutorial to upload files to my website. So, you can also use this for File Upload Server Application with a little modification.

So the first thing I need to do for this android upload video to server project, is to create a php script that will handle the multipart request sent from our android device.

Creating Server Side Scripts

  • Go to your hosting (You can also use wamp/xampp) and create a directory. (I created VideoUpload).
  • Now inside the directory create one more directory named uploads.
  • And create a new file upload.php, and write the following php code.

  • Note down the URL for upload.php and thats all for the server side.

Android Upload Video To Server Project

  • Open android studio and create a new project. I created VideoUpload.
  • Now come to activity_main.xml and write the following xml code.

  • The above code will produce the following layout.
android upload video to server
android upload video to server
  • Now we will create a new class to handle the upload.
  • Create a new class named Upload.java and write the following code.

  • The above code will simply send a multipart request to the URL specified. And will return the response from the server as a string.
  • Now come to MainActivity.java and write the following code.

  • Now add READ_EXTERNAL_STORAGE and INTERNET permission to your manifest file.

  • Now run your application.
android upload video to server
android upload video to server
  • And yes it is working absolutely fine. You can get my source code from the GitHub repository. Just go to the link given below.

Get Android Upload Video to Server using PHP Source from GitHub

[sociallocker id=1372]Android Upload Video To Server[/sociallocker]

Some more Android Application Development Tutorial to Check 

So thats all for this android upload video to server tutorial friends. I haven’t explained the code because we already have seen many tutorials like this. But still if you are having any query regarding this android upload video to server tutorial leave your comments. Thank You 🙂

Hi, my name is Belal Khan and I am a Google Developers Expert (GDE) for Android. The passion of teaching made me create this blog. If you are an Android Developer, or you are learning about Android Development, then I can help you a lot with Simplified Coding.

Expand Your Knowledge: Next Tutorial Picks

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x