关于新浪SAE版weiphp无法上传图片的解决办法

关于新浪SAE版weiphp无法上传图片的解决办法(本次修改的主要是针对SAE商店中的weiphp)。并且sae的storage 命名为weiphp。本次修改一共4个文件:

  1. 修改/Application/Admin/Conf/config.php 将 'PICTUREUPLOADDRIVER'=>defined('SAETMPPATH') ? "sae" : 'local', 'UPLOADSAECONFIG'=>array( 'domain' => defined('SAESTORAGE') ? SAESTORAGE : 'weiphp', ), 替换为: 'PICTUREUPLOADDRIVER'=>'Sae', //SAE上传文件驱动配置 'UPLOADSAECONFIG'=>array( 'rootPath'=>'http://' . $SERVER['HTTPAPPNAME'] . '-uploads.stor.sinaapp.com/Editor/', 'domain'=>'weiphp' ),

  2. 修改/Application/Home/Conf/config.php 将 'PICTUREUPLOADDRIVER'=>defined('SAETMPPATH') ? "sae" : 'local', 'UPLOADSAECONFIG'=>array( 'domain' => defined('SAESTORAGE') ? SAESTORAGE : 'weiphp', ), 替换为: 'PICTUREUPLOADDRIVER'=>'Sae', //SAE上传文件驱动配置 'UPLOADSAECONFIG'=>array( 'rootPath'=>'http://' . $SERVER['HTTPAPPNAME'] . '-uploads.stor.sinaapp.com/Editor/', 'domain'=>'weiphp' ),

  3. 修改ThinkPHP/Conf/conventionsae.php文件
    在配置文件末尾中新添加一行:'FILE
    UPLOAD_TYPE' => 'Sae', // 文件上传方式

  4. 修改图片取得函数: 将:function getcoverurl($coverid) { $url = getcover ( $coverid, 'path' ); if (empty ( $url )) return ''; return SITEURL . $url; } 替换为: function getcoverurl($coverid) { if (empty ( $coverid )) { return ''; } $coverPath = getcover ( $coverid, 'path' ); if (strstr($coverPath, 'http://') or strstr($coverPath, 'https://')) { return $coverPath; } else { return SITE_URL . $coverPath; } }

Hibbs

0