-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertarcaja.php
More file actions
40 lines (31 loc) · 1.28 KB
/
insertarcaja.php
File metadata and controls
40 lines (31 loc) · 1.28 KB
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
<?php
include "./conexion.php";
if(isset($_POST['cod']) && isset($_POST['nom']) && isset($_POST['Cods'])
&& isset($_POST['bodega']) && isset($_POST['sucursal'])
&& isset($_POST['inicial'])){
$carpeta="../images/";
$nombre = $_FILES['imagen']['name'];
//imagen.casa.jpg
$temp= explode( '.' ,$nombre);
$extension= end($temp);
$nombreFinal = time().'.'.$extension;
if($extension=='jpg' || $extension == 'png'){
if(move_uploaded_file($_FILES['imagen']['tmp_name'], $carpeta.$nombreFinal)){
$conexion->query("insert into caja
(CodCaja,CJ_NombreCaja, CJ_Serie,CJ_Bodega,CJ_CodSucursal,MontoInicial) values
(
'".$_POST['cod']."',
'$nombreFinal',
'".$_POST['nom']."',
".$_POST['Cods'].",
'".$_POST['bodega']."',
'".$_POST['sucursal']."',
".$_POST['inicial']."
) ")or die($conexion->error);
header("Location: ../admin/caja.php?success");
}else{
header("Location: ../admin/caja.php?error=No se pudo subir la imagen");
}
}
}
?>