model代码如下:
public function upload(){
if($this->validate()){
if(!file_exists('upuploads/'.date('Y/m/d',time()))){
mkdir('upuploads/'.date('Y/m/d',time()));
}
$this->imageFile->saveAs('uploads/'.date('Y/m/d',time()).'/'.rand(000,999).'.'.$this->imageFile->extension);
return true;
}else{
return false;
}
}
- 报错:mkdir(): No such file or directory
- 尝试解决:修改uploads的权限为777,但未来创建的文件夹都没有777权限
linux服务器 mkdir() 后加 chmod()