08 – PHP Basic File System

0
831

Being a serious PHP programmer it is necessary to learn about how to manipulate files because it gives you great tools for creating, uploading, and editing files. In this tutorial, we’re going to focus on working with the file system and directories in PHP. To start in in this lesson, let’s create first a folder inside the local server name and name it as “file”.
Then inside this folder we’re going to create a simple HTML file and add the following code, then save it as “basichtml.hml”.

At this time, we will create a new PHP file called “basicfile.php”. And take note, one of the most important things about working with files and directory is the magic constant__FILE__ and read as “underscore, underscore capital FILE underscore”. Then let’s add the following code.

This tutorial will serve as a basic fundamental block of building a file system because before we write a file we want to check if the file really exists or not. Or after we have written the file we really want to check if the file does exist. Or we want to check if a file exists before we to want read.

Facebook Comments
Previous article07- PHP Constants
Next article24 – PHP Foreach Loop
Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.