function to change filename not working
Posted: Tue Jan 16, 2007 4:53 am
Iv been trying to get my head round whats going wrong for ages and cant figure out why this doesnt work...
It just returns "16_01_2007." as the filename. No underscores before $date, as id expect if the variables werent set.
Any help is much appreciated.
Code: Select all
function filename() {
// format: client_type_date.ext
$client = $_POST['client'];
$client = strtolower(str_replace(' ', '', $client));
$type = $_POST['type'];
$type = strtolower(str_replace(' ', '', $type));
$date = date('d_m_Y');
$mimetype = $_FILES['userfile']['type'];
$ext = substr(strrchr($mimetype, "."), 1);
return "$client_$type_$date.$ext";
}Any help is much appreciated.