10-17-2007, 10:12 PM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
PHP Code:
// Old, wrong $file_name = str_replace($ext[0], strtolower($info['username']), $ext);
// New, slightly better $file_name = str_replace($ext[0], strtolower($info['username']), $_FILES['upload_avatar']['name']);
You were trying to do a string replacement ( str_replace()) on an array ( $ext). If you read the PHP manual page, you'd know that if an array is used then the return value is also an array. Because of that, when you try to put together the $directory variable, PHP converts the $file_name array into a string: "Array". That's why your files were being called Array.ext.
|
|
|
|