showing results for - "how to paste image on upload js"
Maude
07 Oct 2016
1document.addEventListener('paste', function(e){
2  console.warn(e.clipboardData.items.length);
3  for (var i = 0; i < e.clipboardData.items.length; i++) {
4    var item = e.clipboardData.items[i];
5    console.log('Item: ' + item.type);
6    if (item.type.indexOf('image') != -1) {
7      //item.
8      console.log(item.getAsFile());
9    } else {
10      // ignore not images
11      console.log('Discarding not image paste data', item);
12    }
13  }
14});