-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.html
59 lines (53 loc) · 2.12 KB
/
upload.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Título Aba</title>
<!-- JQuery 1 e 2 and 3 -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<h4>Upload de Imagem</h4>
<div class="form-group uploader">
<label class="coole">Upload Imagem:</label>
<input name="fileToUpload" type="file" id="fileToUpload" /><br />
<div name="image-holder" id="image-holder"><img src="img/usermodel.png" class="placeholder" /> </div>
</div>
<div class="row">
<div class="col-md-4">
<div class="input-group">
<div id="image-holder"><img src="img/usermodel.png" class="placeholder" /></div>
<label class="label-fileToUpload" for='fileToUpload'>Escolher Imagem</label>
<input id="fileToUpload" type="file" id="fileToUpload">
</div>
</div>
</div>
</body>
<script type="text/javascript">
$('#image_holder').show();
$("#fileToUpload").on('change', function() {
if (typeof(FileReader) != "undefined") {
var image_holder = $("#image-holder");
image_holder.empty();
var reader = new FileReader();
reader.onload = function(e) {
$("<img />", {
"src": e.target.result,
"class": "thumb-image",
"width": "128px",
"height": "128px"
}).appendTo(image_holder);
$('.placeholder').hide();
}
reader.readAsDataURL($(this)[0].files[0]);
} else {
alert("This browser does not support FileReader.");
}
});
</script>
</html>