Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/04/2011, 08:15
Avatar de agustincqc
agustincqc
 
Fecha de Ingreso: enero-2010
Ubicación: Argentina
Mensajes: 96
Antigüedad: 14 años, 3 meses
Puntos: 1
Información Problema para subir y renombrar imagen en PHP

Estimados colegas:

Tengo este codigo:

<html>
<body text="#000000">

<br>
<br>
<br>



<form action="subearchivos.php" method="post" enctype="multipart/form-data">
<input name="usuario" type="text" size="35" />
<input name="archivo" type="file" size="35" />
<input name="enviar" type="submit" value="Cargar Imagen" />
<input name="action" type="hidden" value="upload" />
</form>

</body>
</html>
<?php

$status = "";
if ($_POST["action"] == "upload") {
// obtenemos los datos del archivo

$tamano = $_FILES["archivo"]['size'];
$tipo = $_FILES["archivo"]['type'];
$archivo = $_FILES["archivo"]['name'];
$usuario = $_POST["usuario"];


if ($archivo != "") {
if ($tipo == "image/gif" || $tipo == "image/jpeg" || $tipo == "image/jpg" || $tipo == "image/JPEG" || $tipo == "image/JPG" || $tipo == "image/GIF") {

$destino = "subidos/".$usuario.".JPG";

if (copy($_FILES['archivo']['tmp_name'],$destino)) {

$status = "Archivo subido: <b>".$archivo."</b>";

} else {
$status = "Error al subir el archivo";

}

} else {
$status = "Error: solo se permite GIF o JPG";
}

} else {
$status = "Error al subir archivo";
}
}


?>

No logro que la imagen que cargue asignarle el nombre desde el formulario escribiendo en la casilla USUARIO.

Si alguien me pudiera ayudar, totalmente agradecido!!

Saludos !!

ATENCION, ya lo resolvi no se como borrar el tema :S ... saludos !!!
__________________
La mejor banda de Ska Reggae en Argentina www.lachaina.com.ar visiten ;)

Última edición por agustincqc; 19/04/2011 a las 08:36