Call To A Member Function Save As() On A Non-Object

Hiiii I am new in YII …I tryed to uplod an image but I got some error : call to a member function save as() on a non-object

I attach my error screen short and View (_form.php)page , module page and controller page … plz chk and give a urgent reply… Thnxx…

You $uploadedFile is not an object (null?) in line 75 of ProductController.

You have have two (nested) form-tags in _form.php??




var_dump($_FILES);



Please take a look at my comment in the guidelines.


<?php $form=$this->beginWidget('CActiveForm', array(

    'id'=>'product-form',

    // Please note: When you enable ajax validation, make sure the corresponding

    // controller action is handling ajax validation correctly.

    // There is a call to performAjaxValidation() commented in generated controller code.

    // See class documentation of CActiveForm for details on this.

    'enableAjaxValidation'=>false,

    'htmlOptions'=>array('enctype'=>"multipart/form-data"),// <--- add this

)); ?>

its likely your file is not being sent to the server and CUploadedFile return false if there is no image present

And that happens because


'htmlOptions'=>array('enctype'=>"multipart/form-data"),

is missing

Thnk u for the help … itz really a stupid mistek done by me …