Tema: Consulta?
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 31/10/2007, 20:31
Avatar de Seppo
Seppo
 
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 11 meses
Puntos: 17
Re: Consulta?

OK, acá está el 3...
Código PHP:
<?php
if (count($_POST) > 0)
{
    if (!
is_dir('img'))
    {
        
mkdir('img');
    }
    if (!
is_writable('img'))
    {
        
chmod('img'0777);
    }

    if (
is_uploaded_file($_FILES['imagen']['tmp_name']))
    {
        if (!
move_uploaded_file($_FILES['imagen']['tmp_name'], $archivo = ('img/' $_POST['numero'] . '_imagen.' pathinfo($_FILES['imagen']['name'], PATHINFO_EXTENSION))))
        {
            if (!
copy($_FILES['imagen']['tmp_name'], $archivo))
            {
                echo 
'No se puede copiar el archivo';
                die;
            }
        }
    }
    
header('Location: ' $archivo);
    exit;
}
?><form action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" method="post">
Imagen: <input type="file" name="imagen" /><br />
Numero: <input type="text" name="numero" /><br />
<input type="submit" name="subir" />
</form>