seUser
seUser

Reputation: 1103

Javascript file input is not working in IE

I am not able to have below code working in IE. It works fine on Firefox and Chrome.

Anyone can help, how can make this function work on IE?

 function readURL(input) {
   if (input.files && input.files[0]) {
     var reader = new FileReader();

     reader.onload = function (e) {
        $('#img_prev')
                .attr('src', e.target.result)
                .width(160)
                .height(152);
    };

    reader.readAsDataURL(input.files[0]);
  }
}

Upvotes: 1

Views: 2790

Answers (1)

ContextSwitch
ContextSwitch

Reputation: 2837

I've had a similar problem in the past. FileReader is not yet supported in IE:

http://html5demos.com/

You might need to rework your solution if IE support is required to include a regular file upload.

Upvotes: 2

Related Questions