'Не выбран файл!' ], ['importer_id', 'required', 'message' => 'Не указан поставщик!' ], [['file'], 'file', 'extensions' => 'xlsx', 'checkExtensionByMimeType'=>false ] ]; } public function attributeLabels() { return [ 'file' => Yii::t('app', 'Источник'), 'importer_id' => Yii::t('app', 'Поставщик'), ]; } public function readFile( $options = [] ){ $data = Yii::$app->multiparser->parse( $this->file_path, $options ); if( !is_array( $data ) ){ throw new ErrorException("Ошибка чтения из файла RG групп {$this->file_path}"); } return $data; } function __destruct() { // файл больше не нужен - данные прочитаны и сохранены в кеш // if( file_exists($this->file_path) ) // unlink($this->file_path); } }