Answer the question
In order to leave comments, you need to log in
Why is the file not saving?
I save the file in the model (before that, everything worked on another site)
public function upload() {
if ($this->validate()) {
foreach ($this->imageFiles as $file) {
$md5file = substr(md5(microtime() . uniqid()), 0, 10);
if ($file->saveAs('uploads/' . $md5file . '.' . $file->extension)) {
$dbsave = new Photos();
$dbsave->action = $this->action;
$dbsave->url = 'uploads/' . $md5file . '.' . $file->extension;
$dbsave->thumb = 'uploads/thumbs/' . $md5file . '.' . $file->extension;
Image::crop(Yii::getAlias($dbsave->url),580,710,[170,10]) ->save(Yii::getAlias($dbsave->thumb), ['quality' => 100]);
$dbsave->save();
}
}
return true;
} else {
return false;
}
}
Save operation failed
↵
Caused by: ImagickException
unable to open image `uploads/thumbs/2cee633e90.jpg': No such file or directory @ error/blob.c/OpenBlob/2709
print_r($dbsave->thumb);
print_r(Yii::getAlias($dbsave->thumb));
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