-
Notifications
You must be signed in to change notification settings - Fork 0
/
regprod.html
91 lines (77 loc) · 3.39 KB
/
regprod.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<title>Minimarket Aries</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="description" content="Minimarket Aries" />
<meta name="keywords" content="Minimarket Aries" />
<meta name="Resource-type" content="Document" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta http-equiv="cleartype" content="on" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Open Graph data -->
<meta id="og_title" property="og:title" content="Minimarket Aries" />
<meta id="og_url" property="og:url" content="ofertas.html" />
<meta id="og_type" property="og:type" content="website" />
<meta id="og_description" property="Minimarket Aries" />
<!-- imagen-title -->
<link rel="icon" href="imagenes/favicon.ico">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="col-lg-6 mt-3">
<h5>Registrar Productos</h5>
<form id="myform">
<div class="form-group">
<input id="tbDescripcion" class="form-control form-control-sm" type="text" placeholder="ingresar descripción">
</div>
<div class="form-group">
<input id="tbPrecio" class="form-control form-control-sm" type="text" placeholder="ingresar precio">
</div>
<div class="form-group">
<input type="file" class="form-control-file form-control-sm" id="subirImg">
</div>
<div class="form-group">
<button id="btnRegistrar" type="button" class="btn btn-danger btn-sm">Registrar</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
document.getElementById("subirImg").addEventListener("change", capturarImagen);
document.getElementById("btnRegistrar").addEventListener("click", registrarProducto);
function capturarImagen(e){
//console.log(e); metadatos de la imagen
var file = e.target.files[0];
var url = "img/cerveza/"+file.name;
var fgraficos = document.getElementById("subirImg");
var formdata = new FormData();
formdata.append('file',file);
var xhr = new XMLHttpRequest();
xhr.open('POST',url);
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.send(formdata);
xhr.onreadystatechange = function(){
if(xhr.readyState != 4) return;
if(xhr.status != 200){
alert("Status: " + xhr.status);
}else{
alert(xhr.responseText);
}
};
//console.log(file);
}
function registrarProducto(){
var img = new Image();
var descripción = document.getElementById("tbDescripcion").value;
var precio = document.getElementById("tbPrecio").value;
img.save();
img.url();
}
</script>
</body>
</html>