View Single Post
  #2  
Old 16th January 2010, 16:20
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
PHP Code:
  //This line assigns a random number to a variable.  You could also use a timestamp here if you prefer. 
$ran rand () ;

 
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 $ran.".";

  
//This assigns the subdirectory you want to save into... make sure it exists!
$target "images/";  //This combines the directory, the random file name, and the extension
$target $target $ran2.$ext
PHP Code:
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
    echo 
"The file has been uploaded as ".$ran2.$ext;

else
{
    echo 
"Sorry, there was a problem uploading your file.";
}
   
?> 
Try that somewhere....
Reply With Quote