Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/12/2009, 11:02
arielgon
 
Fecha de Ingreso: junio-2009
Mensajes: 31
Antigüedad: 14 años, 11 meses
Puntos: 0
No funciona despues del if() verdadero

Hola sigo con el mismo problema, el if() es verdadero porque el archivo se carga, pero no se ejecuta la sentencia sql, y la variable $nombre si esta fuera del if() la toma como vacia; alguna ayuda porque no encuentro el problema.

$uploaddir = '../albunes/'.$user.'/';
// Whether or not to allow the upload of specific files
$allow_or_deny = true;
// If the above is true, then this states whether the array of files is a list of
// extensions to ALLOW, or DENY
$allow_or_deny_method = "deny"; // "allow" or "deny"
$file_extension_list = array("php","asp","pl");
$original=$_FILES['userfile']['tmp_name'];
$nombre=$_FILES['userfile']['name'];

// -----------------------------------------------------------------------------
if ($original<>""){
if ($allow_or_deny){
if (($allow_or_deny_method == "allow" && !in_array(strtolower(array_pop(explode('.', $nombre))), $file_extension_list))
|| ($allow_or_deny_method == "deny" && in_array(strtolower(array_pop(explode('.', $nombre))), $file_extension_list))){
// Atempt to upload a file with a specific extension when NOT allowed.
// 403 error
header("HTTP/1.1 403 Forbidden");
echo "POSTLET REPLY\r\n";
echo "POSTLET:NO\r\n";
echo "POSTLET:FILE TYPE NOT ALLOWED\r\n";
echo "POSTLET:ABORT THIS\r\n"; // Postlet should NOT send this file again.
echo "END POSTLET REPLY\r\n";
exit;

}

}

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .$nombre))
{

$consultara="SELECT * FROM Album WHERE iduser='".$_SESSION["idlogin"]."' AND album='".$album."'";
$resultadara=mysql_query($consultara);
$linara = mysql_fetch_array($resultadara, MYSQL_ASSOC);
$sqlm="UPDATE Album SET imagen='".$nombre."' WHERE id='".$linara["id"]."'";
$results = mysql_query($sqlm);


// All replies MUST start with "POSTLET REPLY", if they don't, then Postlet will
// not read the reply and will assume the file uploaded successfully.
echo "POSTLET REPLY\r\n";
// "YES" tells Postlet that this file was successfully uploaded.
echo "POSTLET:YES\r\n";
// End the Postlet reply
echo "END POSTLET REPLY\r\n";
exit;


}

Nota: si la sentencia mysql la coloco antes del if() se ejecuta bien pero me toma la variable $nombre vacia.