Preview image on upload (add and remove)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-3.0.0.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<script src="Scripts/jquery.uploadPreview.js"></script>
<script src="Scripts/jquery.uploadPreview.min.js"></script>
<title></title>
<script type="text/javascript">
$(document).ready(function () {
$.uploadPreview({
input_field: "#image-upload",
preview_box: "#image-preview",
label_field: "#image-label"
});
});
</script>
<style type="text/css">
#image-preview {
width: 400px;
height: 400px;
position: relative;
overflow: hidden;
background-color: #ffffff;
color: #ecf0f1;
}
#image-preview input {
line-height: 200px;
font-size: 200px;
position: absolute;
opacity: 0;
z-index: 10;
}
#image-preview label {
position: absolute;
z-index: 5;
opacity: 0.8;
cursor: pointer;
background-color: #bdc3c7;
width: 200px;
height: 50px;
font-size: 20px;
line-height: 50px;
text-transform: uppercase;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
text-align: center;
}
</style>
</head>
<body>
<div id="image-preview">
<label for="image-upload" id="image-label">Choose File</label>
<input type="file" name="image" id="image-upload" />
</div>
</body>
</html>
Share This with your friend by choosing any social account