jothi kumar

jothi kumar

  • 1.5k
  • 104
  • 54.1k

Image Uploading and Instant Preview in Asp.Net MVC

Jul 21 2014 4:14 AM
hi to all,
                  here , i want to upload and instant preview. here i shown my jquery it occur some error can you resolve me and give some tips to upload and instant preview or give another methods for upload and preview


script type="text/javascript">     function PreviewImage(e) {         var preview = document.getElementById('image');         if (e.target.files && e.target.files[0]) {             var reader = new FileReader();             reader.onload = function (e) {                 preview.setAttribute('src', e.target.result);             }             reader.readAsDataURL(e.target.files[0]);         }         else {             preview.setAttribute('src', '/Attachment/Profile/User.png');         }     }      $(function () {         $('#UserProfilePhoto').change(function (e) {             PreviewImage(e);         });     });  </script>

Answers (1)