admin_add
私のファイルには、次のコードが設定されていphotocategories_controller.php
ます。このコードは、自宅の CentOS 開発サーバーでうまく機能します。ただし、このファイルを本番サーバーにアップロードすると機能しません。どんな助けでも大歓迎です〜
function admin_add() {
.... //Other code here
//On folder add, get its ID to be used as the name of the folder
$folderID = $this->Photocategory->getLastInsertId();
//This directory is already created
$uploadDir = '/img/uploads/photos/';
$serverRoot = $_SERVER['DOCUMENT_ROOT'];
//Folder location to be created. When I print it I get
// /home/xxxxxxx/public_html/img/uploads/photos/16 === 16 being the last inserted ID
$directoryPath = $serverRoot.$uploadDir.$folderID;
//I CANNOT FIGURE OUT WHAT AM I DOING WRONG HERE. IT WORKS IN MY DEVELOPMENT
//SERVER, BUT NOT IN MY PRODUCTION SERVER
if(mkdir($directoryPath, 0777)){
if(mkdir($directoryPath."/thumb", 0777)){
$this->Session->setFlash('Success', 'default', array('class' => 'alert_success'));
}else{
$this->Session->setFlash('Error creating thumb', 'default', array('class' => 'alert_error'));
}
}else{
$this->Session->setFlash('Error Creating Directory', 'default', array('class' => 'alert_error'));
}