Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/04/2005, 13:34
gtrombetta
 
Fecha de Ingreso: agosto-2004
Mensajes: 4
Antigüedad: 19 años, 8 meses
Puntos: 0
Guardar imágenes en base de datos MYSQL

Estoy tratando de levantar y almacenar imágenes en bases de datos MySQL como muestro en el siguiente código:

"
Código PHP:
<html>
<body>
<?
include "conexion.php"//conexión a la base de datos

if ($userfile!="none" && $userfile!="")
{
  if (
$userfile_type=="image/jpeg" || $userfile_type=="image/pjpeg" || $userfile_type=="image/gif" || $userfile_type=="image/bmp")
  {

LINEA 9 [COLOR=Red]  $x=addslashes(fread(fopen($userfile,"r"),filesize($userfile)));[/COLOR]

    
$result=mysql_query("INSERT INTO fotos (anchura,altura,tipo,imagen) VALUES (".$info[0].",".$info[1].",'$userfile_type','$x')",$conexion);
    
$id=mysql_insert_id();
    echo 
"Imagen agregada con el id ".$id."<BR>";
    echo 
"<img src='imagen_mostrar.php?id=".$id."'>";
  }else{
    
$error="El tipo de archivo tienes que ser JPG, GIF o BMP.";
  }
}else{
  if (
$userfile!="")
    
$error="No ha seleccionado ninguna imagen...";
}
mysql_close($conexion);
if (
$error!="")
{
  echo 
"</center><P><font face='Arial' size=2 color='#ff0000'> Error: ".$error."</font><br>";
}
?>

<form ENCTYPE="multipart/form-data" action="imagen_agregar.php" method="POST">
  <INPUT NAME="userfile" TYPE="file">
  <p><input type="submit" value="Guardar Imagen" class="boton">
</form>
</body>
</html>
"

El servidor me muestra el siguiente error:

Warning: filesize(): open_basedir restriction in effect. File(/xxxxxx/upl/phpLUkhQJ) is not within the allowed path(s): (/home/xxxxx/:/xxx/xx/php:/usr/local/lib/php:/tmp) in cargar_imagen.php on line 9


Necesito saber como solucionar ese inconveniente

Desde ya muchas gracias.

Última edición por gtrombetta; 21/04/2005 a las 08:31 Razón: Aclaración