Multifunctional File Reader

Recommend this page to a friend!

      Multifunctional File Reader  >  All threads  >  Multifunctional File Reader  >  (Un) Subscribe thread alerts  
Subject:Multifunctional File Reader
Summary:Multifunctional File Reader
Messages:2
Author:Frankie P
Date:2015-07-08 20:46:23
 

  1. Multifunctional File Reader   Reply   Report abuse  
Picture of Frankie P Frankie P - 2015-07-08 20:46:23
It would be nice if there was a way to delete a file inserted accidentially.

  2. Re: Multifunctional File Reader   Reply   Report abuse  
Picture of Andras Toth Andras Toth - 2015-07-09 10:29:45 - In reply to message 1 from Frankie P
Hello Frankie,

It is not very easy because the call back function can include anything.
It is advisable to change the callback function.

For example:

function pickImage(result) {
var div = document.createElement('div');
var str = '<div class="col-sm-6 col-md-4">';
str += ' <div class="thumbnail">';
str += ' <span class="glyphicon glyphicon-remove" style="color:white;top:5px;right:20px;position:absolute;background-color:red;padding:5px;border-radius:50%;"></span>';
str += ' <img src="' + result.data + '" alt="...">';
str += ' <div class="caption">';
str += ' <h4>' + result.name + '</h4>';
str += ' <p>size: ' + (result.size / 1000).toString() + ' kilobyte</p>';
str += ' </div>';
str += ' </div>';
str += '</div>';
div.innerHTML = str;
div.children[0].querySelector('.glyphicon-remove').addEventListener('click', function(e){
e.stopPropagation();
e.preventDefault();
var r = confirm("Are you sure ?");
var el = e.target.parentElement.parentElement;
if (r == true) {
el && el.parentNode && el.parentNode.removeChild(el);
}
});
result.target.appendChild(div.children[0]);
}

You can Try on my demo page.