Click here to Skip to main content
15,071,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a file uploader control fileUpload1
and image control image1
how i can get image preview when i selected image

plz help




thanks
Posted

Hi..
See this one !.
http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files[^] then put save_button.
Thank u.
   
Hi Neeraj,

There is a very good way to do it using jquery,

Please have a look below URL

http://blueimp.github.io/jQuery-File-Upload/[^]

Thanks,
Hitesh Varde
   
   
Comments
neeraj_ 8-Apr-14 4:38am
   
its not worked
Ajith K Gatty 8-Apr-14 5:11am
   
Any error message?
neeraj_ 8-Apr-14 5:50am
   
no sir
Ajith K Gatty 8-Apr-14 6:05am
   
Hello Neeraj,

I checked the code myself and it is working fine. Can you tell me what is happening in your code?

Using alert check whether the control is going inside script or not.
neeraj_ 8-Apr-14 6:10am
   
sir please paste ur code here
i'm totaly unable to do this
Ajith K Gatty 8-Apr-14 6:25am
   
Solution 4 is taken from that link. Hope you get this time.
XML
<form id="form1" runat="server">
<div>
<input type="file" name="filUpload" id="filUpload" onchange="showimagepreview(this)" />
      <img id="imgprvw" alt="uploaded image preview"/>
</div>
</form>


and script is

XML
<script type="text/javascript">
       function showimagepreview(input) {
           alert();
           if (input.files && input.files[0]) {
               var filerdr = new FileReader();
               filerdr.onload = function (e) {
                   $('#imgprvw').attr('src', e.target.result);
               }
               filerdr.readAsDataURL(input.files[0]);
           }
       }
   </script>
   
Comments
neeraj_ 8-Apr-14 7:10am
   
i'm unable
Ajith K Gatty 8-Apr-14 8:07am
   
still problem exists?
neeraj_ 9-Apr-14 1:55am
   
yes sir
i think jquery not worked properly in my project
Ajith K Gatty 9-Apr-14 4:57am
   
for checking purpose get jquery from any CDN. Then try it.

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