Agradezco su ayuda por favor. Este es mi codigo que registra.
Código PHP:
<?php
include("logica/conexion.php");
$target_dir = "./img_certific/";
$target_file = $target_dir . date('Ymd-His') . '_' . basename($_FILES["comprobante"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["comprobante"]["tmp_name"]);
if($check !== false) {
//echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
//echo "File is not an image.";
$uploadOk = 0;
}
}
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
//echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check file size
if (move_uploaded_file($_FILES["comprobante"]["tmp_name"], $target_file)) {
//echo "El archivo ". basename( $_FILES["foto_1"]["name"]). " ha sido cargado.";
} else {
//echo "Sorry, there was an error uploading your file.";
}
$sql="insert into table_certificados values
(null,'".$_POST["nombres"]."','".$_POST["email"]."','".$_POST["grado"]."','".$_POST["ano_curso"]."','".$target_file."','".$_POST["mensaje"]."',now())
";
$res = mysqli_query($conectar, $sql);
echo "<script type=''>
alert('Articulo realizado correctamente');
window.location='cert_estudio.php';
</script>";
?>