QuestionsCategory: General QuestionsBluehost: Create a folder if it doesn’t already exist
Petro
asked 5 months ago
I've encountered errors with WordPress themes on Bluehost because the wp-content/uploads folder wasn't created by their cPanel installer, unlike HostGator's. I need to add code to my theme to check for and create this folder if it doesn't exist.
1 Answers
tech Staff
answered 5 months ago
Hi,  You can using this mkdir:
if (!file_exists('path/to/directory')) {
    mkdir('path/to/directory', 0777, true);
}
Keep in mind that 0777 is the default mode for directories.

Please login or Register to submit your answer