我需要幫助。我已經在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