Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My question is, How to preview image after immediately after clicking browse button in File Upload
Control, please suggest me, Thanks in Advance.
Posted
Comments
Telstra 19-May-14 8:24am    
when exactly you want to preview image. Please improve your question
Baroor 20-May-14 8:48am    
I want after browse button click which work on IE 8.

 
Share this answer
 
Comments
Baroor 20-May-14 8:30am    
Thanks for replying, but it is not working on IE 8.
C#
var reader = new FileReader();
    rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;


    function readURL(input) {
        if (input.files && input.files[0]) {
            //var reader = new FileReader();
            var oFile = input.files[0];
            if (!rFilter.test(oFile.type)) { alert("You must select a valid image file!"); return; }

            reader.onload = function (e) {
                $('#Cheque')
                    .attr('src', e.target.result)
                    .width(668)
                    .height(377);
            };
        }
    }


"#cheque" is img html tag
 
Share this answer
 
Comments
Baroor 20-May-14 8:27am    
But it will not work on IE 8.
SOHAM_GANDHI 20-May-14 8:38am    
try to use updated explorer
Baroor 20-May-14 8:43am    
My project is for IE 8.

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