I am working on this app in the Chrome App Store. Obviously, the file API has changed, so I had to implement FileReader to get the local URL of the file that is being deleted to the page.
function drop(evt) {
v = evt.target.id;
evt.stopPropagation();
evt.preventDefault();
var files = evt.dataTransfer.files;
var f = files[0];
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
document.getElementById(v).src = e.target.result;
};
})(f);
reader.readAsDataURL(f);
}
What I'm trying to do is load the URL of the song that was deleted on the page into the HTML5 tag attribute src. I cannot understand what I am doing wrong with this drop function.
Does anyone have any ideas?
source
share