View Single Post
Old 07-23-2007, 04:56 PM  
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
Need php help, quick question ;)

I have been building a few things lately for fun, This is a standard upload script, i am having trouble renaming the file, where in the code do i need to change so that i could have a random name or base the name off an Id?




$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);


if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote