I am missing something but I'm not sure what it could be...
I'm trying to push the Base 64 code version of a drag-dropped file into a text area... but for some reason it's not working...
Anyone care to tell me where I'm going wrong with the code? This is new territory for me...
$(document).ready(function() {
function processFile(file){
var o = $("#fileInfo");
var reader = new FileReader();
reader.onload = function(e) {
o.innerHTML = e.target.result.replace(/</g, "<").replace(/>/g, ">");
}
reader.readAsURL(file);
}
// Sets up dataTransfer event
jQuery.event.props.push('dataTransfer');
// Bind drop to drop zone
$('#drop-files').bind('drop', function(e) {
// Prevents element from default function
e.preventDefault();
// Grabs list of files
var files = e.dataTransfer.files;
// Loop through files...
$.each(files, function(index, file) {
processFile(files[index]);
});
});
});
I'm seriously not sure where I have screwed up... eventually I will be pushing this to an upload page of my own choosing... but for now I want to at least get the Base64 code of the very first file to show in that text area ("fileInfo").
Appreciate any thoughts here...