public function getBaseName() { // https://github.com/yiisoft/yii2/issues/11012 $pathInfo = pathinfo('_' . $this->name, PATHINFO_FILENAME); return mb_substr($pathInfo, 1, mb_strlen($pathInfo, '8bit'), '8bit'); }
/** * @param \yii\web\UploadedFile $file * * @return int */ public function saveData(\yii\web\UploadedFile $file) { $ext = $file->getExtension(); $baseName = $file->getBaseName(); $model = new \metalguardian\fileProcessor\models\File(); $model->extension = $ext; $model->base_name = $baseName; $model->save(false); return $model->id; }