File Manipulation

If you want to list all files from a folder automatically by using a PHP script and get them with link then here is a very simple method to do that. This script reads contents of a folder and lists those contents with link to them.

{ 0 comments }

Actually I was having hard time in setting up a database backup script. It was using a function and it was not being controlled easily. If I implemented a simple check that if form was posted then run that db-backup script, it was simply giving call to undefined function. By reloading page backup copies are […]

{ 0 comments }

With this PHP script you can find size and type (extension) of required file.

{ 0 comments }

File append means to add on to the existing data, then you need to open the file in append mode.

{ 1 comment }

When you view the contents of a directory you can see all the files that exist in that directory because the operating system or application that you are using displays a list of filenames. You can think of these filenames as links that join the files to the directory you are currently viewing. If you […]

{ 0 comments }

We have to use the function fopen to open the file for reading. Here’s the code to read-open the file.

{ 0 comments }

Now that you know how to open and close a file, lets get on to the most useful part of file manipulation, writing! There is really only one main function that is used to write and it’s logically called fwrite.

{ 0 comments }

The next logical step after you have opened a file and finished your business with it is to close that file down. You don’t want an open file running around on your server taking up resources.

{ 0 comments }

These three basic ways to open a file have distinct purposes. If you want to get information out of a file, like search an e-book for the occurrences of “cheese”, then you would open the file for read only. If you wanted to write a new file, or overwrite an existing file, then you would […]

{ 0 comments }

In PHP, a file is created using a command that is also used to open files. In PHP the fopen function is used to open files. However, it can also create a file if it does not find the file specified in the function call. So if you use fopen on a file that does […]

{ 0 comments }