upload multiple files and rename wih time()

[email protected] ("Emiliano Boragina")
Newsgroups php.db
Message-ID <000001caa743$02e09300$0201a8c0@portbora>
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 = $uploaddir . basename($_FILES[fotog][name][$key]); 


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


      { 


         //revisamos que sea jpg 


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


         { 


            //nombre de la imagen 


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


            //movemos la imagen. 


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


         }else{ 


            $error = true; 


            $errormsg = "Formato no válido para archivo de imagen"; 


         } 


      } else { 


         //imagen no se pudo subir o no seleccionaron. 


         $error=true; 


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


      }//fin file upload. 


          


      //continuamos con el insert. 


      //si hay error no hay imagen. 


      if($error){ 


         $fotog = "N/A"; 


      }

and CODE2:

 

$uploadfile = $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ño & Comunicación
   [email protected]  | 15 33 92 60 02
+                                                 +
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.