javascript - Uploading same file into text box after clearing it, is not working in Chrome -


i trying work example:

http://jsfiddle.net/200eoamf/1/

that code in part, can see 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, not in firefox:

if choose file, myfile.txt, appear in text box. however, if manually clear window selecting entire text , deleting it, , trying upload same file myfile.txt again, won't upload. why happening , how fix it? thanks.

you have 2 options, 1 use clear button user can manually it, option clear value of previous file when user clicks on input. here later: http://jsfiddle.net/200eoamf/12/

element.bind('click', function() {   element.val(null); }); 

thanks blake plumb the idea! :)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -