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

Cita:
Iniciado por GrupoC Ver Mensaje
Si sabes hacerlo igual deberías colgar la solución para colaborar con otros...
Saludos!
Claro, me olvide de decir que lo edite, por la dudas dejo el codigo.
Saludos



<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";
}
}


?>
__________________
La mejor banda de Ska Reggae en Argentina www.lachaina.com.ar visiten ;)