[eluser]jonny68[/eluser]
Hi,
as i upload images in a user folder i need to rename it
but i can't make it.
This is the code:
foreach($files as $file => $value){
$dir = './uploads/'.$this->session->userdata('username').'/';
$file = $files[$field_name]['name'];
rename($dir.$file,$dir.$field_name.$file);
}
It only renames correctly the last uploaded file in the array, the rest are left as they are and i get a php error, eventhough this is the right renamed file..
Message: rename(./uploads/Username/627239P.jpg,./uploads/Username/file_2627239P.jpg) [function.rename]: No such file or directory
THANK YOU IN ADVANCE!!