i have a component class
class ChimagesUploadComponent extends Object{
/***************************** * fileModel is the name of the model used if we want to * keep records of uploads in a database. * * if you don't wish to use a database, simply set this to null * $this->FileUpload->fileModel = null; * * @var mixed * @access public */
var $fileModel = 'Image';
/***************************** * uploadDir is the directory name in the webroot that you want * the uploaded files saved to. default: files which means * webroot/files must exist and set to chmod 777 * * @var string * @access public */
var $uploadDir = 'chimages';
and function in app_controller
function getCurrentUser() {
App::import('Component','Session'); $Session = new SessionComponent();
$user = $Session->read('Auth.User');
return $user; }
i want to use this function in my class ChimagesUploadComponent.
the reason is i want to save the images in different folder retrieving the folder name from the function and saving it accordingly i tried with concatinating
in class ChimagesUploadComponent. i did
$user=$this->getCurrentUser();
$logid = $user['district_id'];
and then tried to concatenate it in
var $uploadDir = 'chimages/'.$logid;
as i have different folders in webroot/chimages/12 webroot/chimages/13 etc. please help