I have 2 controller, TabelAlumniController and DataPersonController
I have 1 model which accessed by two controller above
At localhost, everything going well, no problem at all
At hosting, views of TabelAlumniController going well but views of DataPersonController = Blank Page
I don’t know where is the problem.
Thank you.
This is my DataPersonController:
<?php
class DataPersonController extends Controller
{
public $layout='/layouts/column2';
public function filters()
{
return array(
'accessControl', // perform access control for CRUD operations
'postOnly + delete', // we only allow deletion via POST request
);
}
public function accessRules()
{
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('index', 'update'),
'expression'=>'Yii::app()->user->allAccess()',
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
public function actionIndex()
{
$this->render('index');
}
public function actionUpdate($id)
{
$model=$this->loadModel($id);
if(isset($_POST['TabelAlumni']))
{
$model->attributes = $_POST['TabelAlumni'];
$model->tanggal_lahir = $_POST['TabelAlumni']['tanggal_lahir'];
$file = CUploadedFile::getInstance($model, 'photo');
if(is_object($file) && get_class($file) === 'CUploadedFile')
$model->photo = $file;
if($model->save())
{
//if(!empty($simpanGambar))
if(is_object($file))
$model->photo->saveAs(Yii::app()->basePath.'/../images/fotoProfil/'.$model->photo.'');
Yii::app()->user->setFlash('updateSukses','Data berhasil diperbaharui.');
$this->redirect(array('index','id'=>$model->id));
}
}
$this->render('update');
}
public function loadModel($id)
{
$model=TabelAlumni::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
}
Try to check the log of your web server, i.e error.log for Apache. It should mention something related to the blank page. If you have no access to error.log, try to comment following lines:
I think your problem can be solved by modifying your actionUpdate at your controller and adding public attribute file_diupload at your TabelAlumni model as I mentioned before. It might be caused by the incorrect usage of CUploadedFile::getInstance. Just give a try the modification. If it solves your problem, don’t forget to mention [SOLVED] at this topic.
But i found the problem, my hosting using linux cloud, so name of file/folder/controller case sensitive, that’s why in my localhost (windows) no such problem.