Tools, FAQ, Tutorials:
Creating a Directory in PHP
How To Create a Directory in PHP?
✍: FYIcenter.com
You can use the mkdir() function to create a directory. Here is a PHP script example on how to use mkdir():
<?php if (file_exists("/temp/download")) { print("Directory already exists.\n"); } else { mkdir("/temp/download"); print("Directory created.\n"); } ?>
This script will print:
Directory created.
If you run this script again, it will print:
Directory already exists.
⇒ Removing an Empty Directory in PHP
⇐ Working with Directories and Files in PHP
2016-11-24, 1863👍, 0💬
Popular Posts:
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How to Create a New Instance of a Class? There are two ways to create a new instance (object) of a c...
Where to find tutorials on Microsoft Azure services? Here is a large collection of tutorials to answ...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
Can Multiple Paragraphs Be Included in a List Item? Yes. You can include multiple paragraphs in a si...