javascript - Upload to Google Drive and show progress percentage -


i'm using code below upload large files google drive. how can display progress numeric percentage?

i don't want show progress bar, percentage "20%".

server.gs

function doget(e) {   return htmlservice.createhtmloutputfromfile('upload.html'); }  function uploadfiles(form) {    try {      var dropbox = "uploads";     var folder, folders = driveapp.getfoldersbyname(dropbox);      if (folders.hasnext()) {       folder = folders.next();     } else {       folder = driveapp.createfolder(dropbox);     }      var blob = form.myfile;         var file = folder.createfile(blob);         file.setdescription("videoname_number: " + form.myname);      return "episode uploaded " + file.geturl();    } catch (error) {      return error.tostring();   }  } 

upload.html

<div>   <form id="myform">       <input type="text" name="myname" placeholder="videoname_number">       <input type="file" name="myfile">       <input type="submit" value="upload anime"               onclick="this.value='uploading..';                       google.script.run.withsuccesshandler(fileuploaded)                       .uploadfiles(this.parentnode);                       return false;">   </form>    <div id="output"></div>    <script>       function fileuploaded(status) {           document.getelementbyid('myform').style.display = 'none';           document.getelementbyid('output').innerhtml = status;       }   </script>    <style>    input { display:block; margin: 20px; }   </style> </div> 

there full article on how use google drive api using pure javascript only. article use external file (jquery) known mediauploader. can test quick demo here.

demo of google drive using javascript completely


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -