Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/06/2003, 02:37
patricioo
 
Fecha de Ingreso: agosto-2002
Mensajes: 66
Antigüedad: 21 años, 8 meses
Puntos: 0
Pregunta Subir Imagenes A La Bd

Hola

Estaba haciendo un script para subir imagenes a la bd PERO cuando le digo al script que solo incluya los que son de tipo jpg o gif NO LO HACE porque de algun motivo el if no quiere ver si son iguales y al hacer las pruebas son iguales... en fin aqui està el script pero no jala el if cuando comparo los tipos de imagen:

<?
require("/home/virtual/site13/fst/var/www/html/login/login.php");
$seleccion = 'SELECT contraseña FROM usuarios_lindsayarts WHERE id="'.$_POST['id'].'"';
$query = mysql_query($seleccion);
$num = mysql_num_rows($query);
$row = mysql_fetch_row($query);
$roti = $row[0];
$contraseña_encriptada = md5($roti);


if ($num == 0 OR $contraseña_encriptada != $_POST['password'])
{
header("location: index.php");
exit;
}
$idin = $_POST['id'];

if ($HTTP_POST_FILES['imagen']['tmp_name'] != "")
{

if ($HTTP_POST_FILES['imagen']['type'] != "image/jpeg" OR $HTTP_POST_FILES['imagen']['type'] != "image/gif" OR $HTTP_POST_FILES['imagen']['type'] != "image/pjpeg")
{
echo '<html>';
echo '<head><title>ERROR</title></head>';
echo '<body>';
echo '<script languaje="javascript">';
if ($_POST['idioma'] == "SPANISH")
{
echo 'alert("ERROR: NO ACEPTAMOS FORMATOS DISTINTOS A JPG O GIF");';
}
if ($_POST['idioma'] == "ENGLISH")
{
echo 'alert("ERROR: WE DONOT ACCEPT DISTINCTS FORMATS TO JPG OR GIF");';
}
echo 'navigate("index.php?id1='.$_POST['id1'].'&id2='.$_POST['id2'].'&mostrar='.$_POST['mostrar'].'&idioma='.$_POST['idioma'].'");';
echo '</script>';
echo '</body>';
echo '</html>';
exit;
}



if ($HTTP_POST_FILES['imagen']['size'] > 1024000)
{
echo '<html>';
echo '<head><title>ERROR</title></head>';
echo '<body>';
echo '<script languaje="javascript">';
if ($_POST['idioma'] == "SPANISH")
{
echo 'alert("ERROR: EL ARCHIVO ES MAS GRANDE DE LO PERMITIDO (100 kb)");';
}
if ($_POST['idioma'] == "ENGLISH")
{
echo 'alert("ERROR: THE FILE IS BIGGEST THAN THE PERMITED SIZE (100 kb)");';
}
echo 'navigate("index.php?id1='.$_POST['id1'].'&id2='.$_POST['id2'].'&mostrar='.$_POST['mostrar'].'&idioma='.$_POST['idioma'].'");';
echo '</script>';
echo '</body>';
echo '</html>';
exit;
}


$imagenn = addslashes(fread(fopen($HTTP_POST_FILES['imagen']['tmp_name'], "r"), filesize($HTTP_POST_FILES['imagen']['tmp_name'])));

$seleccion1='UPDATE perfil_publico SET type="'.$HTTP_POST_FILES['imagen']['type'].'" WHERE id="'.$idin.'"';
mysql_query($seleccion1);

$seleccion2='UPDATE perfil_publico SET foto="'.$imagenn.'" WHERE id="'.$idin.'"';
mysql_query($seleccion2);
}
header("location: index.php?id1=$id1&id2=$id2&mostrar=$mostrar&idiom a=$idioma");
exit;
?>

ESPERO ME PUEDAN AYUDAR

¡¡SALUDOS!!