document.addEventListener('paste', function(event) {
var items = (event.clipboardData && event.clipboardData.items) || [];
var file = null;
if (items && items.length) {
for (var i = 0; i < items.length; i++) {
console.log(items)
if (items[i].type.indexOf('image') !== -1) {
file = items[i].getAsFile();
console.log(file)
break;
}
}
}
});