Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/05/2013, 08:35
mir_martin9
 
Fecha de Ingreso: septiembre-2010
Mensajes: 82
Antigüedad: 13 años, 7 meses
Puntos: 0
Incorporar a formulario un de datos subir una imagen

Gente, tengo un problemita, hize un carga de datos, pero no puedo lograr incorporar la carga de foto a la base de datos, la pude hacer un php aparte pero no la puedo incorporar a mi php principal, como puedo hacer para incorporarla y que me suba el url de la foto a la base de datos les dejo el php y html del form plis ayudenme.

Cita:
<html>
<head>
<?php include("conexion.php");

$nombre = $_POST["txtnombre"];
$descripcion = $_POST["txtdescrip"];
$categoria = $_POST["txtcat"];


?>

</head>

<body>
<?php

echo "<table border=0 cellspacing=15>";

mysql_query("INSERT INTO productos (nombre, descripcion, categoria) VALUES ('$nombre', '$descripcion', '$categoria')");

$sentenciaP="SELECT * FROM productos WHERE nombre='$nombre'";
$resultP=mysql_query($sentenciaP);
$rowP=mysql_fetch_array($resultP);

$nombre=$rowP["nombre"];
$descripcion=$rowP["descripcion"];
$categoria=$rowP["categoria"];
$file=$rowP["images"];

echo "<tr> <td> $nombre </td> </tr>
<tr> <td> $categoria </td> </tr>
<tr> <td> $descripcion </td> </tr>
<tr> <td> $file </td> </tr>
<tr> <td> <img src='$file' /> </td> </tr>";
echo "</table>";
?>

<br>
<a href="index.html">Volver</a>
</body>
</html>
y este es el form del html:

Cita:
<html>
<head>

</head>

<body>
<form name="frmCV" method="post" action="audio.php" enctype="multipart/form-data">
<table align='center' border=0 cellspacing=0>
<tr>
<td align='center'>
<h2>Ingresos</h2>
</td>
</tr>
<tr>
<td align='right'>

Nombre: <input type="text" name="txtnombre"><br>
Categoria: <input type="text" name="txtcat"> <br>
Imagen: <input type="file" name="hola"><br>

Descripcion: <textarea name="txtdescrip" rows="10" cols="40">Escribe la descripcion...</textarea> <br>

<br>
<input type="submit" name="btnAceptar" value="Aceptar">
</td>
</tr>
</table>
</form>



</body>
</html>