![]() |
|
PHP File System Functions. Free online PHP and MySQL Web Database Programming Tutorial... |
| Lessons | PHP File System Functions |
|
||||||||||||||||||
|
chmod(), chgrp(), and chown() All of the above three functions are used to modify the permissions, group and the owner of the argument file or directory. Their syntax follows: chmod("filename", mode); chmgrp("filename", newgroup); chown("filename", newowner); copy() We use the copy() function to copy a file. It requires a filename and a destination path in order to copy a file. Its syntax follows: copy("source file", "destination"); fopen() This function is used to open a specified file for reading or writing or a URL for reading only. Its syntax follows: fopen("filename", "mode") The specified mode determines whether the file is opened for reading, writing, or both. The following table lists and describes the values the mode argument can take:
fread() This function is used to read a specified number of bytes from an open file pointer. Its syntax follows: fread(filepointer, length); fputs() This function is used to write to an open file pointer. Its syntax follows: fputs(filepointer, content, [length]); fclose() We use the fclose() function to close an open file pointer. Its syntax follows: fclose(filepointer); mkdir() This function creates a new directory in the file system. Its syntax follows: mkdir("pathname", mode); rename() This function is used to rename an existing file. Its syntax follows: rename("oldname", "newname"); rmdir() This function is used to remove an existing directory form the file system. Its syntax follows: rmdir("pathname"); unlink() This function is used to delete a file from the file system. Its syntax follows: unlink("filename"); Our PHP MySQL Programming Tutorial for Web Developers ends here. How did you find it? Please let us know at pickatutorial@yahoo.com | Tutorial author: farooq_fl@yahoo.com More PHP MySQL Programming Tutorials |