我创建了这个管理员用户页面,可以插入数据。但每次我尝试执行它时都说:
mkdir(): File exists in rental/search/add_property_2.php on line 98
以下是代码:
$p_img9 = $_POST['p_img9'];
$p_img10 = $_POST['p_img10'];*/
if (!file_exists('tmp_imgs/'.$property_id)) { // Creating Temprory Directroy for images
mkdir('tmp_imgs/tmp_'.$property_id, 0777, true); ...Line 98
}
foreach ($_FILES['p_img']['name'] as $f => $name) {
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $name);
$extension = end($temp);
在此寻求帮助
属性ID是自动生成的,在上一页中定义为
$property_id = get_new_property_id();...
和获取错误的第二页
$property_id = $_POST['property_id'];..
答案 0 :(得分:0)
您的检查条件与您正在创建的目录不匹配。您可以像这样修复它
$directory = 'tmp_imgs/tmp_'.$property_id;
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}