大家好,能否帮我解决这个问题。我使用了CodeIgniter的文件上传类,链接在这里,它运行良好!但我需要知道如何在默认上传路径$config['upload_path'] = './uploads/'
中创建目录,目录名是今天的日期,以下是我的示例代码。
date_default_timezone_set('Asia/Manila');
$date = date('Y-m-d H:i:s');
$config['upload_path'] = './uploads/'.$date;
$config['allowed_types'] = 'jpg|jpeg|gif|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
if (!is_dir('uploads/'.$date)) {
mkdir('./uploads/' . $date, 0777, TRUE);
}
我遇到了一个错误,类似于:
Message: mkdir(): Invalid argument
我搜索了如何修复它,他们说这个
0777
CI 权限可以解决问题,但是对我来说仍然不起作用。感谢任何回应。
date('Y-m-d H.i.s')
代替冒号。 - Elavarasan Muthuvalavan - Lee