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.

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.
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.
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.
file_exists
Checking if file exists or not before executing any code block.
Deleting all files
Can we delete all files from a directory? How to give the command.
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.
Display all files of a directory
We can display all files present inside a directory.
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.
Last modified time of a file
When was last time the file was modified? How to get the last modified time of a file?
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.
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.
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.
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.
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.
file_get_contents()
Getting file content as string
file_size()
Getting size of the file.
Running file name
Getting current running file name.
pathinfo()
Maximum execution time
Sample Projects using file and directory functions
Some projects on how to mange file and directory to develop complex scripts using database


Questions

PHP
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Manive

    17-06-2011

    please add more directory tutorials using with php and mysql

    Post your comments , suggestion , error , requirements etc here





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