Creating a Directory in PHP


How To Create a Directory in PHP?



You can use the mkdir() function to create a directory. Here is a PHP script example on how to use mkdir():

if (file_exists("/temp/download")) {
  print("Directory already exists.\n");
} else {
  print("Directory created.\n");

This script will print:

Directory created.

If you run this script again, it will print:

Directory already exists.


Working with Directoris and Files in PHP

⇒⇒PHP Tutorials

2016-11-24, 715👍, 0💬