A
A
Alex Mirgorodskiy2017-08-03 13:43:29
Yii
Alex Mirgorodskiy, 2017-08-03 13:43:29

What is the reason for the error finfo_file(C:\OpenServer\userdata\temp\phpD5B1.tmp): failed to open stream: No such file or directory?

Hello everyone, can you tell me what can cause this error? finfo_file(C:\OpenServer\userdata\temp\phpD5B1.tmp): failed to open stream: No such file or directory.
I'm trying to load 2 pictures into the database, one using the Costarico extension, the other using standard yii2 methods. I still don’t fully understand how the process of downloading a file takes place, so I’m probably doing something wrong. In this design, one by one (first one, then the second) everything works.
Controller:
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->image = UploadedFile::getInstance($model, 'image') ;
if ($model->
$model->upload();
};
$model->bgi = UploadedFile::getInstance($model, 'bgi');
if ($model->bgi) {
$path_bg = Yii::$app->security->generateRandomString(9) . '.' . $model->bgi->extension;
$model->bg = $path_bg;
$model->save();
$model->upload($path_bg);
};
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
public function upload($path_bg = null)
{
if ($this->validate()) {
if ($this->image) {
$path = 'upload/store/contact_info' .$this->image->baseName . '.' . $this->image->extension;
$this->image->saveAs($path);
$this->attachImage($path);
@unlink($path);
}
if ($this->bgi) {
$this->bg = $path_bg;
$this->save();
$this->bgi->saveAs('upload/store/bgi/' .$path_bg);
}
return true;
} else {
return false;
But if I load two at once, I get this error. Hence the question - what could be the problem?
Is it possible to upload several files at once in one Upload, if not, how then to do it, tell me who knows plz

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question