Ver Mensaje Individual
  #7 (permalink)  
Antiguo 06/09/2004, 18:26
Avatar de jahman
jahman
 
Fecha de Ingreso: noviembre-2003
Ubicación: Oslo
Mensajes: 230
Antigüedad: 20 años, 5 meses
Puntos: 0
hola man bueno en realidad no me funciono lo que ud me dijo...ya que no super aplicarlo muy bien...a continuacion esta el codigo que hice para poder subir un archivo a la bd pero mi duda es agragarle el checkbox ( o como se escriba) que seleccione la tabla en que va a ser guardada la foto en la BD, cualquier ayuda se le agradece....

!---guardar.php---!
<?php

if (is_uploaded_file($_FILES['archivo']['tmp_name']) === TRUE)

{

$imagen = mysql_escape_string(join(@file($_FILES['archivo']['tmp_name'])));

$nombre = mysql_escape_string($_POST['nombre']);

$tipo = $_FILES['archivo']['type'];

@mysql_connect('localhost', 'root', '') or die('No se ha podido conectar el servidor de datos');

@mysql_select_db('imagen') or die('La base de datos es inexistente');

if (isset($nombre))

{

if (@mysql_result(@mysql_query("SELECT nombre FROM fotoyo WHERE nombre='$nombre'"), 'nombre')) die('El nombre de la imagen esta actualmente en uso');

}

@mysql_query("INSERT INTO fotoyo(nombre, tipo, imagen) VALUES('$nombre', '$tipo', '$imagen')");

$id = @mysql_insert_id();

echo '
<html>
<body>
<p align="center">Se ha subido la imagen a la base de datos</p>
<br />
<p align="center">ID: ' . $id . '</p>
<p align="center">Nombre: ' . $nombre . '</p>
<br />
<center> <p>Puede verla pulsando <a href="ver_imagen.php?id=' . $id . '">aqu&iacute;</a> </p> </center>
</body>
</html>
';

exit;

}

else

{

echo '
<form enctype="multipart/form-data" method="post" action="' . $_SERVER[SCRIPT_NAME] . '">
Nombre:&nbsp;<input type="text" name="nombre" maxlength="256" />&nbsp;(Opcional) <br>
Archivo:&nbsp; <input type="file" name="archivo" />
<br />
<input type="submit" />
</form>
';

}

?>