Home arrow PHP arrow Page 13 - File And Directory Manipulation In PHP (part 2)

Disk Full - PHP

Now that you know the basics of reading and writing files, this second segment of our tutorial on the PHP filesystem API takes you into deeper waters, showing you how to copy, delete and rename files; scan directories; work with uploaded files over HTTP; perform pattern matches on file names; and read and write to processes instead of files.

  1. File And Directory Manipulation In PHP (part 2)
  2. Stripping It To The Bone
  3. Fertile Fields
  4. Configuring The System
  5. The Right Path
  6. Move It
  7. Beam Me Up
  8. Diving Into Directories
  9. A Pattern Emerges
  10. Purging The Dead
  11. Size Does Matter
  12. In Process
  13. Disk Full
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 65
August 21, 2003

print this article



And that's about all I have. Over the course of the last few pages, I took you ever deeper into the waters of PHP's filesystem API, demonstrating a number of its more arcane features and functions. I showed you how to strip out program code from a file while reading it, how to parse comma-separated data from a file into PHP structures, and how to read configuration variables into a PHP associative array.

Next, I introduced you to PHP's file copy, move and delete functions, and demonstrated them in the context of a file upload application. I also showed you how to read and display the contents of a directory, and how to recursively iterate through a series of nested directories. Finally, I wrapped things up with a brief look at how to obtain disk usage reports for a mount point or partition, and explained how you could read data from processes just as you do with files.

While this tutorial did cover many of the common uses of PHP's file and directory manipulation functions, it is by no means exhaustive. There are many more things you can do with PHP's file functions - and you can get some great ideas (and learn a number of interesting things as well) by perusing the PHP manual pages for these functions, at the links below:

PHP's file manipulation functions, at http://www.php.net/manual/en/ref.filesystem.php

PHP's directory manipulation functions, at http://www.php.net/manual/en/ref.dir.php

And while you busy yourself with those links, I'm off on a short break. See you soon!

Note: Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!

>>> More PHP Articles          >>> More By icarus, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: