<%@ Page Language=
"C#" AutoEventWireup=
"true" CodeFile=
"Default.aspx.cs" Inherits=
"_Default" %>
<!DOCTYPE html>
<html xmlns=
"http://www.w3.org/1999/xhtml">
<head runat=
"server">
<meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8"/>
<title></title>
<script src=
"jquery-1.11.2.min.js"></script>
<script type=
"text/javascript">
$(function () {
$(function () {
$("#fileupload").change(function () {
var reader =
new FileReader();
reader.onload =
function (e) {
$("#img1").attr(
"src",e.target.result);
}
reader.readAsDataURL($(this)[
0].files[
0]);
})
});
})
</script>
</head>
<body>
<form id=
"form1" runat=
"server">
<input id=
"fileupload" type=
"file" />
<img id=
"img1" style=
"width:150px; height:90px;" />
</form>
</body>
</html>
转载于:https://www.cnblogs.com/franky2015/p/5056941.html