Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/09/2015, 01:03
VerGuchi
 
Fecha de Ingreso: septiembre-2015
Mensajes: 6
Antigüedad: 8 años, 7 meses
Puntos: 0
Pregunta Error en código para subir imagen

Código PHP:
function stripAccents($string){
                return 
strtr($string,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ',
                
'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
            }
            
$_FILES["file"]["name"] = stripAccents($_FILES["file"]["name"]);
            
$archivo $_FILES["file"]["name"];
            
$temp explode("."$archivo);
            
$temp end($temp);
            if(
$temp == 'png' || $temp == 'jpg' || $temp == 'gif' || $temp == 'bmp' || $temp == 'jpeg'){
                if (
$_FILES["file"]["error"] > 0){
                    echo 
"Error: " $_FILES["file"]["error"] . "<br>";
                }else{
                    if (
file_exists("images/portadas/" $_FILES["file"]["name"])){
                        
$mensaje "Ya existe una imagen con este nombre.";
                    }else{
                        
move_uploaded_file($_FILES["file"]["tmp_name"],
                            
"images/portadas/" $_FILES["file"]["name"]);
                    }
                }
            }else{
                
$mensaje "El formato de la imagen es invalido.";
            }
        }
            
$imagen "images/portadas/".$archivo
Lo curioso es que ya lo había usado anteriormente y si funcionó, ahora lo incrusté a un $_POST y solo me da la variable $imagen con el valor de "images/portadas/ y no sube el $archivo (nombre) ni al servidor ftp