hi,
recently im working on upload picture.
issue is : whenever i uploaded file limit size more than 10 mb the error message is not appearing from model, instead of the showing error message from apache.
PHP.ini-settings already changed to 10mb
post_max_size = 10M
upload_max_filesize = 10M
my profilepciture controller
public function actionUpdate($id)
{
$default=new Profilepicture;
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Profilepicture' ]))
{
if($model->ProfilePicture_Image == 'default.png') {
$rnd = rand(0,9999); // generate random number between 0-9999
$model->attributes=$_POST['Profilepicture'];
$uploadedFile=CUploadedFile::getInstance($model,'ProfilePicture_Image');
$fileName = "{$rnd}-{$uploadedFile}"; // random number + file name
$model->ProfilePicture_Image = $fileName;
}else{
$_POST['Profilepicture']['ProfilePicture_Image'] = $model->ProfilePicture_Image;
$model->attributes=$_POST['Profilepicture'];
$uploadedFile=CUploadedFile::getInstance($model,'ProfilePicture_Image');
}
if($model->save())
{
if(!empty($uploadedFile))
// check if uploaded file is set or not
{
$uploadedFile->saveAs(Yii::app()->basePath.'/../images/uploads/'.$model->ProfilePicture_Image);
}
Yii::app()->user->setFlash('success','Gambar pemohon berjaya upload');
//$this->refresh();
$this->redirect(array('applicantdetail/laf','id'=>$id));
}
}
$this->render('update',array(
'model'=>$model,
));
}
my model -profilepicture
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
//array('ProfilePicture_Image', 'required'),
array('ProfilePicture_Image', 'file','types'=>'jpg, gif, png', 'maxSize'=>1024 * 1024 * 1, 'tooLarge'=>'File has to be smaller than 1MB' , 'allowEmpty'=>true, 'on'=>array('insert','update')), // this will allow empty field when page is update (remember here i create scenario update)
array('Fk_ApplicantDetail', 'safe'),
array('Fk_ApplicantDetail', 'numerical', 'integerOnly'=>true),
//array('ProfilePicture_Image', 'length', 'max'=>255 ,'tooLong' => '{attribute} is too long (max {max} chars).', 'on' => 'update'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('Profile_Id, ProfilePicture_Image, Fk_ApplicantDetail', 'safe', 'on'=>'search'),
);
}
still dont know where is the mistake.
pls guide me.
tq