Advertisement
rodro1

instant jquery upload image show

Mar 22nd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. $(document).on('change','.immidiate-show',function(){
  2. files = this.files;
  3. $.each( files, function(){
  4. file = $(this)[0];
  5. if (!!file.type.match(/image.*/)) {
  6. var reader = new FileReader();
  7. reader.readAsDataURL(file);
  8. reader.onloadend = function(e) {
  9. img_src = e.target.result;
  10. html = "<img class='img-thumbnail' style='width:300px;margin:20px;' src='"+img_src+"'>";
  11. $('.immidiate-show-box').append( html );
  12. };
  13. }
  14. });
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement