如何保留注册页面的照片

时间:2013-02-11 07:11:04

标签: yii

我想保留注册页面的照片列,以便用户可以选择图像并在该列中显示我在yii框架中使用ImageSelect扩展但它无法正常工作建议我如何在注册时保留图像用户

这是我的ImageSelect代码

<?php echo $form->labelEx($model,'profileImage'); ?>
    <?php
$this->widget('ext.imageSelect.ImageSelect',  array(
    'path'=>Yii::app()->baseUrl . '/images/Penguins.jpg',
    'alt'=>'alt text',
    'uploadUrl'=> 'profileinfo/upload',
    'htmlOptions'=>array()
));
?>

我的控制器代码是

public function actionUpload()
{

    $file = CUploadedFile::getInstanceByName('file');
    // Do your business ... save on file system for example,
    // and/or do some db operations for example

    $file->saveAs(Yii::app()->baseUrl . '/images/'.$file->getName());


    // return the new file path
    echo Yii::app()->baseUrl.'/images/'.$file->getName();
}

0 个答案:

没有答案