我需要帮助。我已经在cakephp中构建了一个web应用程序。在本地主机eveything工作得很好。图像被上传,插入,正确删除。我上传到服务器的那一刻就显示错误!在服务器上传图片失败CAKEPHP
通知(8):未定义指数:滑块[APP /型号/ Slider.php,线245]
通知(8):未定义指数:滑块[APP /型号/ Slider.php ,线247]
警告(2):的unlink(/ home8/ceraunia /的public_html/AFS/CESI /管理/应用程序/根目录/ IMG /上传/滑块/图像/)[function.unlink]:是一个目录[APP/Model/Slider.php,line 248]
我不知道该怎么做,或者问题出在哪里。正如我在localhost中提到的,一切都很完美。我使用的主机服务器是blueHost。
任何帮助将是非常appruciated ..
编辑:
氏是导致该问题的代码:
public function afterSave($created, $options = array()) {
$dir = 'img' . DS . 'uploads' . DS . 'slider' . DS . 'images' . DS; /*<=== DO NOT EDIT*/
// then after deletation of the row we check if the file exist, if so we delete it.
if(isset($this->data[$this->alias]['pic_path']) && file_exists(WWW_ROOT . $dir . $this->image['Slider']['pic_path'])){
$img = WWW_ROOT . $dir . $this->image['Slider']['pic_path'];
unlink($img);
return true;
} else { $this->data[$this->alias]['pic_path'] = $this->image['Slider']['pic_path']; }
return true;
}
对于查看模型Slider的第245行和第247行可能有用吗?此外,服务器的一些规格(例如PHP版本)与您的本地主机相比。你没有给我们很多信息来处理。 – Nunser
我加了你问的额外的代码行......我不知道我在这里错过了什么你有任何想法@Nunser? – landi
对于我所看到的,不知道'$ this-> image'是什么,那个数组根本没有索引。现在,它为什么没有它?我不知道,也许会展示如何将这些数据保存在第一位?并且请添加您的本地主机和服务器的php和mysql版本 – Nunser