Solid
            (Jorgen1987)
          
          
          
              
              
          1
          
         
        
          Hi all!
Prolly a fast one for the experienced users.
I have a webapp for my public_html and one for my admin_html, server-root like this:
SERVER
-framework/
-protected/
-admin_prot/
-public_html/
-admin_html/
Separating the backend totally from the frontend.
My problem is when im uploading images in my backend, i cant seem to save them in my frontend… iv’e tried several variations like:
$model->pic->saveAs(Yii::getPathOfAlias('webroot').'/images/'.$model->pic);
$model->pic->saveAs(Yii::getPathOfAlias('webroot').'/../images/'.$model->pic);
ive allso tried Yii::setPathOfAlias(‘public_images’, ‘/public_html/images/’);
Anyone care to tell me where i stepped wrong? 
Appriciate it!
         
        
          
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            seenivasan
            (Chellamnivas)
          
          
          
              
              
          2
          
         
        
          Dear Friend
$model->pic->saveAs($model->pic);
The above code would save the image in  webroot folder itself.
$model->pic->saveAs("images/".$model->pic);
The above code will save the image in webroot/images folder.
Regards.
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            Solid
            (Jorgen1987)
          
          
          
              
              
          3
          
         
        
          Thank you,
that is an improvement on the code. But i cant seem to work out how thats helpfull to my actual problem 
Anyone have any sulution on saving an image in folders behind the webroot and application?
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            seenivasan
            (Chellamnivas)
          
          
          
              
              
          4
          
         
        
          Dear Friend
Kindly check that whether the following is helpful to you.
I hope there may be better and simpler solution exists.
Now I have two applications(yii) in my localhost.
1.boost.(/var/www/boost)
2.nivas.(/var/www/nivas)
Now we want to save images from application boost into a folder residing in application nivas.
That means we want to save in /var/www/nivas/images.
The following is the controller logic in boost.
public function actionUpload()
{
	$model=new FileForm;
	$webPath=dirname(dirname(Yii::app()->basePath));
	$imagePath=$webPath."/nivas/images";
	if(isset($_FILES["FileForm"]))
	{
		$files=CUploadedFile::getInstances($model,"files");
		foreach($files as $file)
			$file->saveAs($imagePath."/".$file->name);
						
	}
	$this->render('upload',array("model"=>$model));			
}	
Yii::app()->basePath;//   /var/www/boost/protected
dirname(Yii::app()->basePath);//    /var/www/boost 
dirname(dirname(Yii::app()->basePath));//  /var/www
dirname(dirname(Yii::app()->basePath))."/nivas/images";//   /var/www/nivas/images 
I hope I helped a bit.
Regards.