如题,使用redactor教程,但是插入图片显示空白,然后底部debug显示POST和GET都是500 Error。查看了细节是说 'Invalid config $uploadDir'。

解决办法

更新版本,开发商做了一些改变,以防止出现此错误

https://github.com/yiidoc/yii2-redactor/commit/bcbcae81ba0552c928969896fef6817eb85f26d6

 

更改    yiidoc/yii2-redactor/RedactorModule.php 中 getSaveDir() 内容为以下

public function getSaveDir()
{
   
    $path = Yii::getAlias($this->uploadDir) . DIRECTORY_SEPARATOR . $this->getOwnerPath();    
    if(!file_exists($path)){      
        if (!FileHelper::createDirectory($path, 0775,$recursive = true )) {
            throw new InvalidConfigException('$uploadDir does not exist and default path creation failed');
        }
    }
    return $path;
}