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
JavaScript
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>
Guest UserRank #258 · 9.8K pointsPosted Jul 21, 2014, 9:25 AM EDT