javascript - How to save a file on Dropbox using dropbox-saver API -


i share part of code doing encryption files. code works fine when tried save encrypted file on local hard drive when tried save encrypted file on cloud using javascript saver api, got data in form of data uri. of have idea how issue tackled?

// javascript code:

// html5 filereader object allow read      // contents of  selected file.      var reader = new filereader();      if(body.hasclass('encrypt')){          // encrypt file!          reader.onload = function(e){              // use cryptojs library , aes cypher encrypt              // contents of file, held in e.target.result, password              var encrypted = cryptojs.aes.encrypt(e.target.result, password);              // download attribute cause contents of href             // attribute downloaded when clicked. download attribute             // holds name of file offered download.               a.attr('href', 'data:application/octet-stream,' + encrypted);             a.attr('download', file.name + '.encrypted');                step(4);         };          // encode contents of file data-uri.         // trigger onload handler above, result          reader.readasdataurl(file);     } 

// html code

            <div class="content">                 <h1>your file ready!</h1>                 <a class="button download green">download on computer</a>                 <a class="button download dropbox-saver green">cloud</a>              </div>          </div> 

thanks in advance assistant , efforts.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -