在我的控制器中我有:
$model->attributes=$_POST['Societes'];
$file=CUploadedFile::getInstance($model,'logo');
$extension = $file->getExtensionName();
$filename = md5_file($file->tempName);
$fullFilename = $filename . '.' . $extension;
$model->logo=$fullFilename;
if($model->save())
{
$file->saveAs(Yii::app()->basePath . '/../images/' . $fullFilename);
$this->redirect(array('view','id'=>$model->id));
在我看来,我有:
<input type="file" id="id_photo" name="photo">
运行此命令我收到此错误:
Call to a member function getExtensionName() on a non-object