- Back to Home »
- JAVASCRIPT »
- Fileupload preview image using javascript
Posted by : ஆனந்த் சதாசிவம்
Saturday, July 6, 2013
CSS :
<style>
#imgPreview
{
filter: progidXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
width: 136px;
height: 134px;
margin-left: 1px;
}
</style>
Script:<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> function PreviewImg(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#imgPreview').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } </script>
HTML :<asp:FileUpload ID="file" runat="server" size="20" Width="258px" onchange="PreviewImg(this)"/> <img id="imgPreview" src="#"/>
Nice Collection of Blogs. Thank you so much Sir for your posts. I always look forward to see your Blogs.
ReplyDeleteFor more Information Visit Website Web Designing Course in Rohini