PHP file handling functions

PHP File Handling

File handling is an important part of all type of PHP web application.
PHP has in-built file system function to access and manipulate the file.

In this PHP tutorial we learn manipulate various type of file using file system functions.
PHP has functions for creating file, reading files, opening files, uploading files and editing files.

The files can be .doc file, .txt file, .xml file any kind of file supports all php function for manipulate files.

PHP File manipulation functions :

  • touch() – used to create a file.
  • unlink() – used to delete a file.
  • copy() – used to copy a file.
  • rename() – used to rename a file.
  • file_exists() – used to check whether the file exists or not.
  • filesize() – used to check size of file.
  • realpath() – used to check real path of file.
  • fopen() – used to open existing file.
  • fread() – used to reads from an pen file.
  • fwrite() – used to write to file.
  • fclose() – used to close an open file.

We will learn all above file system function one by one in next php tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *