Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/11/2007, 11:18
Avatar de davincci
davincci
 
Fecha de Ingreso: enero-2005
Mensajes: 193
Antigüedad: 20 años, 1 mes
Puntos: 0
Elegir Carpeta

Hola a todos, tengo una inquietud y es poder elegir a que carpeta del servidor se ira mi imagen que subire, es decir se hace lo de siempre, examinar... selecciono la imagen y por medio de un list/le digo: varios - paraisos - noches - amanecer. Y despues guardo la extension de la imagen en la bd y la estension de la carpeta donde queda.

tengo el codigo para subir una imagen y me guarda la extension en la bd y funciona bien, como hago para adaptarle lo que acabo de decir?.

aqui el formulario de insercion:

Código PHP:
<html>

<
head>

<
title></title>

<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<
META lang=es content="" name=Keywords>

<
META content="" name=Description>

<
META content=worldwide name=coverage>

<
META content=all name=robots>

<
META content=general name=rating>

<
META content="1 days" name=revisit-after>

<
meta name="distribution" content="local">

</script>

<script language="JavaScript1.2">

<!--

top.window.moveTo(0,0);

if (document.all) {

top.window.resizeTo(screen.availWidth,screen.availHeight);

}

else if (document.layers||document.getElementById) {

if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){

top.window.outerHeight = screen.availHeight;

top.window.outerWidth = screen.availWidth;

}

}

//-->

</script>

<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/prototype.js"></script>

<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>

<script type="text/javascript" src="js/lightbox.js"></script>

<link href="estilo.css" rel="stylesheet" type="text/css">

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../estilo.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo1 {font-size: 16pt}
.Estilo2 {font-weight: bold}
-->
</style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">



<table width="837" height="462" border="0" align="center" cellpadding="0" cellspacing="0" id="principal">

    <tr>

      <td width="2" height="462" class="leftshadow"></td>

        <td width="831" height="462" valign="top" class="leftbox"><p align="center">&nbsp;</p>
          <p align="center"><span class="titulos Estilo2 Estilo1">INSERTAR  IMAGENES</span></p>
          <form enctype="multipart/form-data" action="proceimages.php" method="POST">
            <label>
            <div align="center">
              <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
              <br />
<strong>Insertar imagen</strong>:
<input name="imagen" type="file" />
<input type="submit" name="enviar" value="Enviar" />
</div>
            </label>
          </form>
          <p>&nbsp;</p>
      </td>
        <td width="4" align="center" valign="top" class="watermark">&nbsp;</td>
  </tr>
</table>

</body>

</html> 

este el de procesar

Código PHP:
<html>

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<META lang=es content="" name=Keywords>

<META content="" name=Description>

<META content=worldwide name=coverage>

<META content=all name=robots>

<META content=general name=rating>

<META content="1 days" name=revisit-after>

<meta name="distribution" content="local">

</script>

<script language="JavaScript1.2">

<!--

top.window.moveTo(0,0);

if (document.all) {

top.window.resizeTo(screen.availWidth,screen.availHeight);

}

else if (document.layers||document.getElementById) {

if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){

top.window.outerHeight = screen.availHeight;

top.window.outerWidth = screen.availWidth;

}

}

//-->

</script>

<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/prototype.js"></script>

<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>

<script type="text/javascript" src="js/lightbox.js"></script>

<link href="estilo.css" rel="stylesheet" type="text/css">

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../estilo.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo1 {font-size: 16pt}
-->
</style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">



<table width="837" height="462" border="0" align="center" cellpadding="0" cellspacing="0" id="principal">

    <tr>

      <td width="2" height="462" class="leftshadow"></td>

        <td width="831" height="462" valign="top" class="leftbox"><p align="center">&nbsp;</p>
          <p align="center"><span class="titulos Estilo2 Estilo1">INSERCION DE IMAGENES</span></p>
          <div align="center">
            <p><strong>Im&aacute;gen recibida</strong></p>
          </div>
          <?php
define
('HOST''localhost');
define('DB''');
define('USERNAME''');
define('PASSWORD''');

$link = @mysql_connect(HOST,USERNAME,PASSWORD);
if (!
$link) {
   die(
'En este momento no hay conexion con la base de datos.');
}
   
mysql_select_db(DB) or die("No se ha seleccionado base de datos.");  
if (isset(
$_POST['enviar'])) {

 
    
$upload_dir '../imagprod/';
    
$upload_file $upload_dir $_FILES['imagen']['name'];
    
$imagen $_FILES['imagen']['name'];

    if (
move_uploaded_file($_FILES['imagen']['tmp_name'], $upload_file)) {
          
        
$query "INSERT imagenes SET imagen='$imagen'";
        
mysql_query($query);

    } else {
           
    }


}
?>
<p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
      <p align="center">&nbsp;</p></td>
        <td width="4" align="center" valign="top" class="watermark">&nbsp;</td>
  </tr>
</table>

</body>

</html>


Gracias de antemano
__________________
Mil gracias por sus enseñanzas.

Davincci