I am trying to create directories for better file organization. The front-end for this is a form where a user will input the title, content and the region(dropdown menu). When the user submit the form, the data will be taken to a file named save.php and will be processed. Below are the codes on the save.php file. Actually the main goal for this is to produce an html file and then organize these html files into folders by region. I cant make the mkdir() to work. The message "directory created" is always printed out but there is no actual folder created. What do you think is the problem on my code? What I want to happen is that when the user clicks on the "submit" button, folders with region names will be created. Please help? Or any suggestion or another way to solve this problem?
$ad_title = $_POST['title'];
$ad_content = $_POST['content-ads'];
$ad_region = $_POST['region'];
if (!is_dir("uploads/"$ad_region)) {
// dir doesn't exist, make it
mkdir("uploads/".$ad_region);
echo "directory created!";
}
else {
echo "directory already exist!";
}
EDIT: I dont know if this matters but my save.php file and the uploads folders where the codes above is saved in the local directory
localhost/system/modules/new
When I relocated the save.php file and the uploads folder in the directory
localhost/system/
all seems to be working now.But I want it to work in the localhost/system/modules/new directory for better organization. Any help on this?