In my cakePHP Model i'm trying to use a custom validator to move file to new location an check its success. the custom method is:
//custom method to check image
public function processCoverUpload($check = array()) {
if (!is_uploaded_file($check['issue_cover']['tmp_name'])) {
return FALSE;
}
if (!move_uploaded_file($check['issue_cover']['tmp_name'], WWW_ROOT . 'img' . DS . 'uploads' . DS . $check['issue_cover']['tmp_name'])) {
return FALSE;
}
$this->data[$this->alias]['issue_cover'] = 'uploads' . DS . $check['issue_cove']['tmp_name'];
return TRUE;
}
however $check['issue_cove']['tmp_name']
returns file name including its path.
This will lead to wrong path string in move_uploaded_file. So how can i have only file name out of 'tmp_name'?
sample
$check['issue_cove']['tmp_name'] is F:\xampp\tmp\phpF765.tmp
but i want phpF765.tmp
only.