1

Alert not come when onchange event in internet explore ?

i am use below code:

<input type="file" onChange="readURL(this)"  />
<script src="http://code.jquery.com/jquery-1.8.0.min.js " > </script>
<script>
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        alert('asf');
        reader.onload = function(e) {
            //alert(e.target.result);
            $('#photoview').attr('src', e.target.result);
        }
        reader.readAsDataURL(input.files[0]);
    }
}
</script>
Anthony Grist
  • 38,173
  • 8
  • 62
  • 76
sabari
  • 502
  • 1
  • 8
  • 18
  • You can check below link for solution in IE. [Stack Over Flow Solution][1] [1]: http://stackoverflow.com/questions/10214947/upload-files-using-input-type-file-field-with-change-event-not-always-firin – Chirag Babaria Dec 04 '12 at 13:27
  • You can check below link for solution in IE. [Stack Over Flow URL][1] [1]: http://stackoverflow.com/questions/10214947/upload-files-using-input-type-file-field-with-change-event-not-always-firin – Chirag Babaria Dec 04 '12 at 13:28

2 Answers2

0

IE9 doesn't have the FileReader.

See compatibility table at end of this MDN documentation. Note that this document also proposes a solution for compatibility with IE.

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
0

for IE you have to use FileSystemObject activex component

for more details check this link :

http://www.java2s.com/Tutorial/JavaScript/0600__MS-JScript/FileSystemObjectGetFile.htm

Mahmoud Farahat
  • 5,364
  • 4
  • 43
  • 59