MUploadify

Hi ! Gustavo,

i am having problem with widget. i am getting http erro (302). but i am not understanding while printing $_POST[‘image’] i am getting following result

QHJAQE 710828_549711818374259_211186367_n.jpg

folder /Applications/MAMP/htdocs/hrmspluscore/sourcecode/protected/../images/

folder is correct but the actual submitted variable name ought be image .it is being generating randomly(QHJAQE)…any hints please ?

[b]

following is view :[/b]

$this->widget(‘ext.uploadify.MUploadify’,array(

            'name'=>'image',


            'buttonText'=>Yii::t('application','Browse'),


            'script'=>$this->createUrl('bankdetails/uploadfile'),


            'method'=>'post',


            'fileExt'=>'*.jpg;*.png;',


            'multi'=>true,


           


            'auto'=>false,


            'onError' => 'js:function(evt,queueId,fileObj,errorObj){alert("Error: " + errorObj.type + "\nInfo:" + errorObj.info);}',


            'onCancel' => 'js:function(evt,queueId,fileObj,data){alert("Cancelled");}',





          ));

[b]

Controller ::[/b]

public function init(){

if(isset($_POST[‘SESSION_ID’])){

$session=Yii::app()->getSession();


$session->close();


$session->sessionID = $_POST['SESSION_ID'];


$session->open();

}

}

function actionUploadfile(){

if(isset($_POST[‘image’])){

$image = CUploadedFile::getInstanceByName('image');


$image = $image->getName('image');


$image_url = $path.$image;


if(!$image->saveAs($image_url))


{


  throw new CHttpException(500);


} else{


        Yii::app()->user->setFlash('success', "Data1 saved!");


      }


        echo 1;


        Yii::app()->end();


 }

}

any help will be appreciated.

Regards

Hi I have been trying to implement this extension but no luck.

I have write in controller:




public function actionCreate()

	{

		$model=new ImageUpload();


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['ImageUpload']))

		{

            $model->path=CUploadedFile::getInstance($model,'path');

            if(!$model->save() || !$model->path->saveAs('someFile.jpg'))

                throw new CHttpException(500);

            echo 1;

            Yii::app()->end();

		}


		$this->render('create',array(

			'model'=>$model,

		));

	}




and at top of the form




'htmlOptions'=>array(

        'enctype'=>'multipart/form-data',

        'enableClientValidation'=>true),



and in the form field




$this->widget('application.extensions.uploadify.MUploadify',array(

            'model'=>$model,

            'attribute'=>'path',

            'script'=>$this->createUrl('ImageUpload/create'),

            'auto'=>true,

            //'someOption'=>'someValue',

        ));




and in the rule array of model:




array('path', 'file','types'=>'jpg, gif, png', 'allowEmpty'=>true, 'on'=>'update'),



I am getting the error as:

Please help me.