upload multiple files and rename wih time()

------=_NextPart_000_0001_01CAA729.DD935B00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello php fellows,



I have two codes to upload multiple files, works very well, but I cant
rename the files... really i dont know...

CODE1:



$uploadfile =3D $uploaddir . basename($_FILES[fotog][name][$key]);


if (is_uploaded_file($_FILES['fotog']['tmp_name'][$key]))


{


//revisamos que sea jpg


if ($_FILES['fotog']['type'][$key] =3D=3D "image/jpeg" ||
$_FILES['fotog']['type'][$key] =3D=3D "image/pjpeg")


{


//nombre de la imagen


$fotog =3D time().".jpg";;


//movemos la imagen.


move_uploaded_file($_FILES['fotog']['tmp_name'][$key],
"../originales/".$fotog);


}else{


$error =3D true;


$errormsg =3D "Formato no v=E1lido para archivo de imagen";


}


} else {


//imagen no se pudo subir o no seleccionaron.


$error=3Dtrue;


$errormsg =3D "Error al cargar imagen: " .
$_FILES['fotog']['name'][$key];


}//fin file upload.





//continuamos con el insert.


//si hay error no hay imagen.


if($error){


$fotog =3D "N/A";


}

and CODE2:



$uploadfile =3D $uploaddir . basename($_FILES[fotog][name][$key]);


//echo $uploadfile;


if (move_uploaded_file($_FILES['fotog']['tmp_name'][$key],
$uploadfile))


{


echo $value . ' uploaded<br>';


}



How can I do this?

Thanks a lot,





+ +
Emiliano Boragina | Dise=F1o & Comunicaci=F3n
emiliano.boragina [at] gmail.com | 15 33 92 60 02
+ +




------=_NextPart_000_0001_01CAA729.DD935B00--
Emiliano Boragina [ Sa, 06 Februar 2010 16:42 ] [ ID #2031533 ]

Re: upload multiple files and rename wih time()

Emiliano Boragina wrote:
> Hello php fellows,
>
>
>
> I have two codes to upload multiple files, works very well, but I cant
> rename the files... really i dont know...

The code looks ok. Do you get an error message? If not, turn up
error_reporting and enable display_errors:

error_reporting(E_ALL);
ini_set('display_errors', true);

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
dmagick [ Mo, 08 Februar 2010 00:29 ] [ ID #2031653 ]
PHP » gmane.comp.php.database » upload multiple files and rename wih time()

Vorheriges Thema: Cross reference query help
Nächstes Thema: Storing Images #2