Ver Mensaje Individual
  #19 (permalink)  
Antiguo 13/02/2008, 06:27
Avatar de hgp147
hgp147
 
Fecha de Ingreso: diciembre-2006
Ubicación: Buenos Aires, Argentina
Mensajes: 980
Antigüedad: 19 años, 10 meses
Puntos: 36
Re: Ayuda por favor

Código PHP:
<?
$status 
= "";
if (
$_POST["action"] == "upload") {
// obtenemos los datos del archivo
$tamano = $_FILES["archivo"]['size'];
$tipo = $_FILES["archivo"]['type'];
$archivo = $_FILES["archivo"]['name'];
$prefijo = substr(md5(uniqid(rand())),0,6);

if ((
strpos($tipo, "gif") || strpos($tipo, "jpeg")) && $tamano < 100000) {
// guardamos el archivo a la carpeta files
$destino = "files/".$prefijo."_".$archivo;
if (
copy($_FILES['archivo']['tmp_name'],$destino)) {
$status = "Archivo subido: <b>".$archivo."</b>";
} else {
$status = "Error al subir el archivo";
}
} else {
$status = "Error al subir archivo";
}
}
?>