PHP file handling functions

PHP file handling functions are used in different conditions in any script development. You can use them to create a simple file upload or image upload or gallery script for storing images and many more. These built in functions gives flexibility in developing complex scripts. We will discuss some of the PHP file handling functions with their detail uses and code samples.
Related Tutorial
Directory functions

Reading a file

We can read file in our server or external server by using fread function. We can create a pointer to the file and read the content by specifying the size of data to be collected. Read More

Writing to a file

We must have write permission to enter data to a file. We have to open the file in write mode and then enter data. Read More

Deleting files

How to delete files from a server? We should have permission and after deleting we can get a conformation message on success or failure of delete command. Read More


Checking if file exists or not before executing any code block. Read More

Deleting all files

Can we delete all files from a directory? How to give the command. Read More

Downloading files from server

We can give data to our visitors in CSV or ZIP format to download. Once the command is given it should ask the visitor to save the file in local computer. Read More

Display all files of a directory

We can display all files present inside a directory. Read More

How to get current file name

We can develop a common code which can be plugged into any file. But here the file name of the file may be required as a parameter. So we have to know the file name executing the code. Read More

Last modified time of a file

When was last time the file was modified? How to get the last modified time of a file?Read More

Displaying last updated time of the file

We can use the function to get last modified time of the file and display the same within the file. Read More

Searching text between two landmarks of a file

We can collect text between two landmarks of data present within a file. We can use the opening tag of title and closing tag of title as landmarks and collect the text used inside the title of the page. Read More

All titles of files present inside a directory

We can display all titles of the files present inside a directory. We will be using directory handler to list all files and then use landmarks to collect the text within title of each file. Read More

How to upload images or files to server

How to develop a simple script to upload files to the server through web browser. This basic script tell about the requirements of a simple file upload in a website. Read More

Multiple file upload

We can upload more than one file at a time. Learn how to handle multiple files at the same time to upload. Read More

Thumbnails image generation

We can create dynamically thumbnail of any uploaded image file. This can be used as a part of any image gallery script or any other type of script. Read More

Sample Projects using file and directory functions

Some projects on how to mange file and directory to develop complex scripts using database
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net



    please add more directory tutorials using with php and mysql

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer