Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/10/2011, 11:33
kasumidie
 
Fecha de Ingreso: octubre-2011
Ubicación: CABA
Mensajes: 63
Antigüedad: 12 años, 7 meses
Puntos: 1
panel.php subir varias imagenes

En este panel tengo el image1, que sube perfectamente, yo le quiero agregar 4 imagenes más, y si hay posibilidad de que las reduzca en tamaño. Las lineas image2 las agrege yo, en la BD tengo hasta image5, probe varias formas y no pude hacer que funcione, soy novato en el tema. Saludos y gracias.

Código PHP:
<?php

if (count ($_POST)!=0){

$host="localhost";
$database="xxx";
$username="xxx";
$password="xxx";

$uploads_dir '';
print_r ($HTTP_POST_FILES);
        
$tmp_name $HTTP_POST_FILES["image1"]["tmp_name"];
        
$name $HTTP_POST_FILES["image1"]["name"];
        
move_uploaded_file($tmp_name"$name");
        

$lo_hice_bien=mysql_connect($host,$username,$password);
if (
$lo_hice_bien){
    
mysql_select_db ($database);
    
$query2="INSERT INTO detalles (tipodepropiedad,operacion,ubicacion,barrio,precio,superficie,descripcion,caracteristicas,image1,image2) VALUES('".$_POST ["tipodepropiedad"]."','".$_POST ["operacion"]."', '".$_POST ["ubicacion"]."'";
    
$query2.=", '".$_POST ["barrio"]."', '".$_POST ["precio"]."', '".$_POST ["superficie"]."', '".$_POST ["descripcion"]."','".$_POST ["caracteristicas"]."', '".$name."')";
    
$result2 mysql_query($query2);
    
$idinsertadomysql_insert_id();
    
$query="INSERT INTO noticias (tipodepropiedad,operacion,ubicacion,barrio,precio,superficie,descripcion,caracteristicas,image1,image2,detalle_id) VALUES('".$_POST ["tipodepropiedad"]."','".$_POST ["operacion"]."', '".$_POST ["ubicacion"]."','".$_POST ["barrio"]."', '".$_POST ["precio"]."', '".$_POST ["superficie"]."'";
    
$query.=", '".$_POST ["descripcion"]."','".$_POST ["caracteristicas"]."', '".$name."', '".$idinsertado."')";
    echo 
$query;
    
$result mysql_query($query);
    if (!
$result && !$result2) {
        die(
'Hay algo mal' mysql_error());
        }
}
echo 
"Hecho";
mysql_close($lo_hice_bien);
}

?>

<html>
<head>
<title>Panel de Control | SP</title>
</head>
<center><body style="background: url('http://190.18.15.149/images/fondo.gif');">
<div style="background:white; font-family:verdana; font-size:10px; width:960px; padding:15px;">
<img src="http://190.18.15.149/images/banner.gif"><br></br>
<div style="border-style:solid; border-width:1px; border-color:rgb(181,184,195);">
<form enctype="multipart/form-data" id="panel" name="panel" method="post" action="panel.php">
    <h1 style="color:#ff6c00;">Panel de Control</h1>
    
    <p><label><p>Tipo de propiedad</p><input type="text" id="tipodepropiedad" name="tipodepropiedad" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Operacion:</p><input type="text" id="operacion" name="operacion" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Ubicacion:</p><input type="text" id="ubicacion" name="ubicacion" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Barrio:</p><input type="text" id="barrio" name="barrio" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Precio:</p><input type="text" id="precio" name="precio" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Superficie:</p><input type="text" id="superficie" name="superficie" size="50" maxlength="100" value="" /></label></p>
    
    <p><label><p>Descripcion:</p><textarea id="descripcion" name="descripcion" cols="50" rows="6" maxlength="1500"></textarea></label></p>
    
    
    <p><label><h3 style="color:#ff6c00;">Caracteristicas del inmueble </h3><textarea id="caracteristicas" name="caracteristicas" cols="50" rows="6" maxlength="1500"></textarea> </label></p>
    
    <p><label><p>Imagen:</p><input type="file" id="image1" name="image1" value="examinar"/></p></label>
    <p><label><p>Imagen:</p><input type="file" id="image2" name="image2" value="examinar"/></p></label>
    <p><input type="submit" name="Publicar" value="Publicar"/></p>
</form>
</div>
<center>
<p>© Copyright <a href="">SP</a> 2011. Todos los derechos reservados. 
</center>
</div>
</body></center>
</html>