I want to save my files and images in directory, but I found out that the directory is empty.
the directory is: "data/course_admin_files/course_files"
See the screen shot below:
7319
controller
$coursefile = UploadedFile::getInstance($model, 'coursefile');
if(!is_null($coursefile))
{
foreach ($this->coursefile as $file) {
$model->course_file_name = $coursefile->name;
$ext = end((explode(".", $coursefile->name)));
$model->course_file_path = Yii::$app->security->generateRandomString().".{$ext}";
Yii::$app->params['uploadPath'] = Yii::$app->basePath . '/../web/data/course_admin_files/course_files/';
$path = Yii::$app->params['uploadPath'] . $model->course_file_path;
$file->saveAs($path);
}
Please help me out