Answer the question
In order to leave comments, you need to log in
How to attach uploaded files to a message?
In the feedback form, I upload files using CUploadedFile
How to attach uploaded files to a message?
In the controller I send a letter
if ($model->validate()) {
//Так пытаюсь загрузить файлы
if($filez=$this->uploadMultifile($model,'attachments','/tmp/attachments/'))
{
$model->attachments=implode(",", $filez);
}
//Как прикрепить файлы к сообщению
$headers = "From: $email";
$message = '<p>Э-почта: ' . $model->email . '</p>'
. '<p>Имя: ' . $model->name . '</p>'
. '<p>Сообщение: ' . $model->body . '</p>';
$message. = '';//Как прикрепить файлы к сообщению
// ... отправка сообщения администратору ...
mail('[email protected]', $subject, $message, $headers);
echo CActiveForm::validate($model);
Yii::app()->end();
} else {
echo CActiveForm::validate($model);
}
}
Yii::app()->end();
} else {
throw new CHttpException(404, 'Указанная запись не найдена');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question