Here i am uploading the images into the seperate folder which is in application.protected.uploads but how get that image from the folder and display on the screen any help please here is my uploaded code
controller
$dir = Yii::getPathOfAlias(‘application.protected.uploads’);
$uploaded = false;
$model = new Upload();
if (isset($_POST['Upload']))
{
$model->attributes = $_POST['Upload'];
$file = CUploadedFile::getInstance($model,'file');
if ($model->validate())
{
$uploaded = $file->saveAs($dir. '/' .$file->getName());
}
}
view :
<?php if ($uploaded): ?>
<p>File was uploaded. Check <?php echo $dir?> . </p>
<?php endif ?>
<?php echo CHtml::beginForm(’’,‘post’,array
(‘enctype’=>‘multipart/form-data’))?>
<?php echo CHtml::error($model, ‘file’)?>
<?php echo CHtml::activeFileField($model, ‘file’)?>
<?php echo CHtml::submitButton(‘Upload’)?>
<?php echo CHtml::endForm()?>