Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <form id="form1" runat="server">
  2. <input type='file' id="imgInp" />
  3. <img id="target" src="#" alt="your image" />
  4. </form>
  5. function readURL(input) {
  6. if (input.files && input.files[0]) {
  7. var reader = new FileReader();
  8. reader.onload = function (e) {
  9. $('#target').attr('src', e.target.result);
  10. }
  11.  
  12. reader.readAsDataURL(input.files[0]);
  13. }
  14. }
  15.  
  16. $("#imgInp").change(function(){
  17. readURL(this);
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement