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'));
}