I am trying to work with this example:
http://jsfiddle.net/200eoamf/1/
that is the code in part, you can see all the code in jsfiddle:
var onFileReadFn = $parse(attrs.onReadFile);
var reader = new FileReader();
reader.onload = function() {
var fileContents = reader.result;
// invoke parsed function on scope
scope.$apply(function() {
onFileReadFn(scope, {
'contents' : fileContents
});
});
};
reader.readAsText(element[0].files[0]);
The following issue occurs in Chrome browser, but not in Firefox:
If I choose file, say myfile.txt, it will appear in the text box. However, if I manually clear that window by selecting the entire text and deleting it, and then trying to upload the same file myfile.txt again, it won't upload. Why is this happening and how to fix it? Thanks.