-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.php
63 lines (62 loc) · 2.22 KB
/
file.php
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
<html>
<head>
<style type="text/css">
.success, .error, .validation {
border: 1px solid;
margin: 10px 0px;
padding:5px 10px 5px 10px;
background-repeat: no-repeat;
background-position: 10px center;
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
text-align:left;
width:auto;
}
.success {
color: #4F8A10;
background-color: #DFF2BF;
background-image:url('imagenes/correcto.JPG');
}
.error {
color: #D8000C;
background-color: #FFBABA;
background-image: url('imagenes/error.jpg');
}
</style>
</head>
<body>
<?php
$archivo = (isset($_FILES['queryFile'])) ? $_FILES['queryFile'] : null;
if ($archivo) {
$extension = pathinfo($archivo['name'], PATHINFO_EXTENSION);
$extension = strtolower($extension);
$extension_correcta = ($extension == 'json');
if ($extension_correcta) {
//$ruta_destino_archivo = "{$archivo['name']}";
$ruta_destino_archivo = "LastQuery.json";
$archivo_ok = move_uploaded_file($archivo['tmp_name'], $ruta_destino_archivo);
echo '<div class="success"><b>Archivo cargado con éxito</b></div>';
?>
<script type="text/javascript">
function redireccionarPagina() {
window.location = "upload.html";
}
setTimeout("redireccionarPagina()", 2000);
</script>
<?php
}
else {
echo '<div class="error"><b>Extensión Inválida</b></div>';
?>
<script type="text/javascript">
function redireccionarPagina() {
window.location = "upload.html";
}
setTimeout("redireccionarPagina()", 2000);
</script>
<?php
}
}
?>
</body>
</html>