Advertisement
chrisdaloa

Image Capture

Feb 25th, 2020
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //In HTML
  2. <div>
  3.     <img :src="this.dogUrl"   />
  4. </div>              
  5. <div>
  6.     <input type="file" accept="image/*" capture="camera" @change="cattura" ref="nome_foto"  >
  7.  </div>
  8.  
  9. //In Methods
  10.         cattura(event){
  11.             this.selectedFile = event.target.files[0];          
  12.             const fd = new FormData();        
  13.             this.immagine = URL.createObjectURL(this.selectedFile)
  14.             fd.append('image', this.selectedFile, this.selectedFile.name);                          
  15.             this.dogUrl = this.immagine
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement