October 7

PHP Directory Functions


Using PHP we can do many operation with directories or folders. Upload, download, re-size, crop, open directory, read directory, close directory, read data and much more….

Some of the frequently used file system functions are as below;

  • chdir — Change directory
  • chroot — Change the root directory
  • closedir — Close directory handle
  • dir — Return an instance of the Directory class
  • getcwd — Gets the current working directory
  • opendir — Open directory handle
  • readdir — Read entry from directory handle
  • rewinddir — Rewind directory handle
  • scandir — List files and directories inside the specified path


1.  PHP Directory – chdir

The PHP chdir() function is used to change the control from the current working directory to the user specified directory. It returns TRUE on success otherwise PHP Warning  Continue reading