Guest User

Untitled

a guest
Dec 13th, 2016
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Code:
  2.  
  3. var fd = new FormData();
  4.  
  5.     this.venue_images.forEach(function(i) {
  6.       window.resolveLocalFileSystemURL(i, (entry) => {
  7.         entry.file(function(file) {
  8.           var reader = new FileReader();
  9.           reader.readAsDataURL(file);
  10.  
  11.           reader.onloadend = (err) => {
  12.             //console.log(new Blob([this.result], { type:file.type}));
  13.             var imgBlob = new Blob([this.result], { type:file.type});
  14.             fd.append('attachments', imgBlob, this.venue_images[i].split('/').pop());
  15.             //console.log(this.result);
  16.             //fd.append('file' + (this.venue_images.indexOf(path)+1), imgBlob);
  17.             //fd.append('fileName' + (this.venue_images.indexOf(path)+1), file.name);
  18.           };
  19.  
  20.           reader.readAsArrayBuffer(file);
  21.         }, (err) => {
  22.           console.log('error getting file', err);
  23.         })
  24.       }, (err) => {
  25.         console.log('Error resolving fs url', err);
  26.       })
  27.     })
RAW Paste Data