Hello, I do not know why you give me that error, please help is urgent, what I want to do is send a file to the server (if it is sent), but it does not save the files in the Mysql database, the PHP version is 7.3.0 This is my code:
include 'config.php';
if(is_uploaded_file($_FILES['archivo']['tmp_name'])) {
$ruta = $_SERVER['DOCUMENT_ROOT'].'/subir_archivo/uploads/';
$nombrefinal= trim ($_FILES['archivo']['name']); //Eliminamos los espacios en blanco
$nombrefinal= preg_replace ("[^A-Za-z0-9]", "", $nombrefinal);//Sustituye una expresión regular
$upload= $ruta . $nombrefinal;
if(move_uploaded_file($_FILES['archivo']['tmp_name'], $upload)) { //movemos el archivo a su ubicacion
echo "<b>Upload exitoso!. Datos:</b><br>";
echo "Nombre: <i><a href=\"".$ruta . $nombrefinal."\">".$_FILES['archivo']['name']."</a></i><br>";
echo "Tipo MIME: <i>".$_FILES['archivo']['type']."</i><br>";
echo "Peso: <i>".$_FILES['archivo']['size']." bytes</i><br>";
echo "<br><hr><br>";
$numCertificado = $_POST["numeroCertificado"];
$razonSocial = $_POST["razonSocial"];
//$fecha = $_POST["fecha_expedicion"];
$direccion = $_POST["direccion"];
$mysqli -> query = ("INSERT INTO Certificado (numeroCertificado,razonSocial,direccion,ruta)
VALUES ('$numCertificado','$razonSocial','$direccion',
'".$numCertificado."',
'".$razonSocial."',
'".$direccion."')");
}
}
the connection code:
<?php
$host = "localhost";
$dbuser = "root";
$dbpwd = "";
$db = "csc_certificaciones";
$conexion = mysqli_connect($host,$dbuser,$dbpwd,$db);
if(!$conexion)
die("Connection failed: " . mysqli_connect_error());
else
echo "Connected successfully";
?>
the connection does work because I did another test and if it works and stores it in the database, what can I try?