Comentário: Este artigo apresenta principalmente o exemplo de visualização do upload da imagem HTML5. Amigos que precisam podem se referir a ele.
<! Doctype html>
<html lang = "zh-cn">
<head>
<meta charset = "utf-8" />
<meta content = "edielei" />
<Title> HTML5 Image Upload Preview </ititle>
<script type = "text/javascript" src = "<a href =" http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js "> </script"> </script </a >>
<script type = "text/javascript">
$ (function () {
$ ('#img'). alteração (function () {
var arquivo = this.files [0]; // Selecione o arquivo carregado
var r = new FileReader ();
r.readasdataurl (arquivo); // base64
$ (r) .load (function () {
$ ('div'). html ('<img src = "' + this.result + '" />');
});
});
});
</script>
</head>
<Body>
<H3> visualização de upload de imagem html5 </h3>
<input type = "file" aceit = "image /*" />
<div> </div>
</body>
</html>