Vidhi Maheshwari
Vidhi Maheshwari

Reputation: 74

upload video to youtube from my android application using javascript

I want to upload a video to youtube from my installable android application. Is there a way to do it by javascript only without calling native android codes

Upvotes: 0

Views: 588

Answers (2)

Randroid
Randroid

Reputation: 3698

This JavaScript function, confirms that the user has selected a file to upload. If the user has not selected a file, then the function displays an error message.

  <script type="text/javascript">
   function checkForFile() {
   if (document.getElementById('file').value) {
  return true;
   }
    document.getElementById('errMsg').style.display = '';
    return false;
  }
 </script>

   <form action="URL?nexturl=http%3A%2F%2Fwww.example.com" method="post"
   enctype="multipart/form-data" onsubmit="return checkForFile();">
  <input id="file" type="file" name="file"/>
 <div id="errMsg" style="display:none;color:red">
   You need to specify a file.
 </div>
 <input type="hidden" name="token" value="TOKEN"/>
  <input type="submit" value="go" />
  </form>

Upvotes: 0

Related Questions