wahi
(Salmahussain06)
1
Hello,
In root index.php:
"Yii::createWebApplication($config);
define(‘UPLOAD_DIRECT’,Yii::app()->baseUrl.’/images/upload_folder/’);
Yii::app()->run();"
In controller I am calling this constant while uploading image under create function, like
$uploadedFile->saveAs(UPLOAD_DIRECT.$fileName);
while uploading I am getting error as " Use of undefined constant UPLOAD_DIRECT - assumed ‘UPLOAD_DIRECT’ ".
I am new to yii framework can anyone help me to sort out this.
Thanks waahi. 
wally
(Fosales)
2
Hi Sally,
You can try to create a Helper class and declare a constant:
class Helper {
const UPLOAD_DIRECT = Yii::app()->baseUrl.'/images/upload_folder';
}
In your controller:
$uploadedFile->saveAs(Helper::UPLOAD_DIRECT.$fileName);
wahi
(Salmahussain06)
3
Thanku for ur reply,
where do I create helper class?
wally
(Fosales)
4
You can create it inside model folder.