Click here to Skip to main content
16,019,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys

i had create one functionality of image preview on file upload,

that is working fine in firefox and crome

but there is a problem in IE,

can you give the ans..??
<img src="#" id="preview"   />

<input type="file" id="userfiles" name="userfile" value="userfiles" class="set_file" 
                                     önchange="javascript:readURL(this)"  />

<script type="text/javascript">
/*$('input.set_file').click(function(){
  document.getElementById("userfiles").onchange = function(evt) {
    alert(evt.target.id);
}
});*/
function readURL(input)
{
	
      if (input.files && input.files[0])
              {
				  
		            var reader = new FileReader();
                   reader.onload = function (e)
                                          {
											  
                                                $('#preview')
                                                .attr('src',e.target.result)
                                                .width(192)
                                                .height(225);
                                          };
                   reader.readAsDataURL(input.files[0]);
                   }
}
</script>
Posted
Updated 11-Mar-13 21:21pm
v2

1 solution

There is no answer.

So you will upload an image to server. So use php to pass link to image.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900