Posts

Showing posts from 2012

Preview an image before it is uploaded

<script type = "text/javascript" >         function readURL ( input ) {             if ( input . files && input . files [ 0 ]) {                 var reader = new FileReader ();                 reader . onload = function ( e ) {                     $ ( '#blah' ). attr ( 'src' , e . target . result );                 }                 reader . readAsDataURL ( input . files [ 0 ]);             }         }     </script> and the associated HTML: <body>     <form id = "form1" runat = "server" >         <input type = 'file' onchange = " readURL ( this ); " />     ...