Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Create a folder if it doesn't already exist #10810
    blankjoaorodr84
    Participant

    If you want to avoid the file_exists vs. is_dir problem, I would suggest you to look here.

    I tried this and it only creates the directory if the directory does not exist. It does not care if there is a file with that name.

    /* Creates the directory if it does not exist */
    $path_to_directory = 'path/to/directory';
    if (!file_exists($path_to_directory) && !is_dir($path_to_directory)) {
        mkdir($path_to_directory, 0777, true);
    }
    
Viewing 1 post (of 1 total)