upload multiple files and rename wih time()
am 06.02.2010 16:42:35 von Emiliano Boragina------=_NextPart_000_0001_01CAA729.DD935B00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello php fellows,
=20
I have two codes to upload multiple files, works very well, but I cant
rename the files... really i dont know...
CODE1:
=20
$uploadfile =3D $uploaddir . basename($_FILES[fotog][name][$key]);=20
if (is_uploaded_file($_FILES['fotog']['tmp_name'][$key])) =20
{=20
//revisamos que sea jpg=20
if ($_FILES['fotog']['type'][$key] == "image/jpeg" ||
$_FILES['fotog']['type'][$key] == "image/pjpeg")=20
{=20
//nombre de la imagen=20
$fotog =3D time().".jpg";;=20
//movemos la imagen.=20
move_uploaded_file($_FILES['fotog']['tmp_name'][$key],
"../originales/".$fotog);=20
}else{=20
$error =3D true;=20
$errormsg =3D "Formato no v=E1lido para archivo de imagen";=20
}=20
} else {=20
//imagen no se pudo subir o no seleccionaron.=20
$error=3Dtrue;=20
$errormsg =3D "Error al cargar imagen: " .
$_FILES['fotog']['name'][$key];=20
}//fin file upload.=20
=20
//continuamos con el insert.=20
//si hay error no hay imagen.=20
if($error){=20
$fotog =3D "N/A";=20
}
and CODE2:
=20
$uploadfile =3D $uploaddir . basename($_FILES[fotog][name][$key]); =20
//echo $uploadfile;=20
if (move_uploaded_file($_FILES['fotog']['tmp_name'][$key],
$uploadfile)) =20
{ =20
echo $value . ' uploaded
';=20
}
=20
How can I do this?
Thanks a lot,
=20
=20
+ +
Emiliano Boragina | Dise=F1o & Comunicaci=F3n
emiliano.boragina@gmail.com | 15 33 92 60 02
+ +
=20
------=_NextPart_000_0001_01CAA729.DD935B00--