Comments: This article mainly introduces examples of html5 Image Upload and preview. For more information, see
The Code is as follows:
<! DOCTYPE html>
<Html lang = "zh-cn">
<Head>
<Meta charset = "UTF-8"/>
<Meta name = "author" content = "EdieLei"/>
<Title> HTML5 Image Upload preview </title>
<Script type = "text/javascript" src = "<a href =" http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js "> </script"> http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js "> </script </a>
<Script type = "text/javascript">
$ (Function (){
$ ('# Img'). change (function (){
Var file = this. files [0]; // select the uploaded file
Var r = new FileReader ();
R. readAsDataURL (file); // Base64
$ (R). load (function (){
Certificate ('div'0000.html (' ');
});
});
});
</Script>
</Head>
<Body>
<H3> HTML5 Image Upload preview <Input id = "img" type = "file" accept = "image/*"/>
<Div> </div>
</Body>
</Html>