0
나는, 링크를 표시 할 수 YII 폴더에서 파일을 다운로드하는 링크를 만들려고하지만 클릭하면 그 다음은 내 코드입니다 오류를 Error 403 You are not authorized to perform this action.
다운로드 파일 YII 오류 403
을 보여
public function actionView2($id)
{
$this->render('view2',array(
'model'=>$this->loadModel($id),
));
}
_view.php
<b><?php echo CHtml::encode($data->getAttributeLabel('image')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->image), array('view2', 'id'=>$data->image), array('target'=>'_blank'));
?>
<br />
view2.php
<h1>View2 #<?php echo $model->image; ?></h1>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'image',
),
)); ?>
나는 그것을 승인 또는 그런 일의 발생 생각,하지만 난이 방법을 시도 할 것이다 accessRules에서 아무것도 변경하거나 UserIdentity.php
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
UserIdentity.php
public function authenticate()
{
$users=array(
// username => password
'demo'=>'demo',
'admin'=>'admin',
);
if(!isset($users[$this->username]))
$this->errorCode=self::ERROR_USERNAME_INVALID;
elseif($users[$this->username]!==$this->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
$this->errorCode=self::ERROR_NONE;
return !$this->errorCode;
}
아니에요 열심히 할 수 있겠지만, 이것이 해결 될 수 없다면, "다운로드 링크"를하는 또 다른 최선의 방법이 있습니까?
Yii 시스템 내에서 폴더가 보호되어 있습니까? – Jonnny
아니요, 그렇지 않습니다. 나는 이미 full (rwx) – andrian