I am trying to upload a photo with its respective data such as: name, date of creation, among other data, to my MYSQL database but I can only save the image in a server folder, but not insert the image in the bd nor your data, this is my code:
subir.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title> Agregar Noticias </title>
</head>
<body>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h3>Subir Imagenes de Productos </h3></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><form action="Val_Upload.php" method="post" enctype="multipart/form-data" name="form1">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150">Modelo:</td>
<td width="250"><label>
<input name="modelName" type="text" id="modelName">
</label></td>
</tr>
<tr>
<td>marca:</td>
<td>
<input name="marcaName" type="text" id="marcaName">
</td>
</tr>
<tr>
<td>TIpo: </td>
<td><input name="nomTIpo" type="text" id="nomTIpo"></td>
</tr>
<tr>
<td>Valor:</td>
<td><input name="precio" type="text" id="precio"></td>
</tr>
<tr>
<td>Lanzamiento:</td>
<td><input name="aniolanzamiento" type="date" id="aniolanzamiento"></td>
</tr>
<tr>
<td>Fecha Publicacion:</td>
<td><input name="fechapublicacion" type="date" id="fechapublicacion"></td>
</tr>
<tr>
<td>Imagen:</td>
<td><label>
<input name="archivo" type="file" id="archivo">
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="Submit" value="Enviar">
</label></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
code process.php
<?php
require_once ("Connections/conection.php");
//capturamos los datos del fichero subido
$type=$_FILES['archivo']['type'];
$tmp_name = $_FILES['archivo']["tmp_name"];
$name = $_FILES['archivo']["name"];
//Creamos una nueva ruta (nuevo path)
//Así guardaremos nuestra imagen en la carpeta "images"
$nuevo_path="img/catalogo/".$name;
//Movemos el archivo desde su ubicación temporal hacia la nueva ruta
# $tmp_name: la ruta temporal del fichero
# $nuevo_path: la nueva ruta que creamos
move_uploaded_file($tmp_name,$nuevo_path);
//Extraer la extensión del archivo. P.e: jpg
# Con explode() segmentamos la cadena de acuerdo al separador que definamos. En este caso punto (.)
$array=explode('.',$nuevo_path);
# Capturamos el último elemento del array anterior que vendría a ser la extensión
$ext= end($array);
//Imprimimos un texto de subida exitosa.
echo "<h3>La imagen se subio correctamente</h3>";
// Los posible valores que puedes obtener de la imagen son:
echo "<b>Info de la imagen subida:</b>";
echo "<br> Nombre: ".$_FILES['archivo']["name"]; //nombre del archivo
echo "<br> Tipo: ".$_FILES['archivo']["type"]; //tipo
echo "<br> Nombre Temporal: ".$_FILES['archivo']["tmp_name"]; //nombre del archivo de la imagen temporal
echo "<br> Tamanio: ".$_FILES['archivo']["size"]." bytes"; //tamaño
mysqli_query("INSERT into producto(archivo) values ('$imagen_path')");//esto no me funciona
$Sql = "insert into producto(nombreModelo, nombreMarca, nombreTipo, precio, aniolanzamiento, fechapublicacion, pix) values ('$nombreModelo', '$nombreMarca','$nombreTipo','$precio','$aniolanzamiento','$fechapublicacion','$Nombre_Archivo')"; //esto codigo tampoco me funciona
?>
I would like to know what I am doing wrong, how can I solve this error? thanks