Home  |  Linux  | Mysql  | PHP  | XML
From:Emiliano Boragina Date:Sat Feb  6 10:42:35 2010
Subject:upload multiple files and rename wih time()
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; 




         } 


      } 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@gmail.com  | 15 33 92 60 02
+                                                 +

 


Navigate in group php.db at sever news.php.net
Previous Next


Your recent visits
Re: [PHP-WIN] Can i run php script using command prompt in any location by typing scriptname.php
Re: Dumping vars from CGI with Data::Dumper
More compact way to write this
sybase-ct with PHP sending blank user name and password


  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants