PHP File Handling

Jussi Pohjolainen

Tampere Polytechnic University of Applied Sciences » ICT

Web architecture

Three tiered architecture

PHP and File Handling

Opening a file or directory

Creating file

Reading file using fgets

Writing to a file using fputs

Locking

Example of file Locking

Error handling

Create your own functions with error handling

file_put_contents

Copying and deleting files