Home arrow PHP arrow Creating an Error Handling Module for a PHP 5 File Uploader

Creating an Error Handling Module for a PHP 5 File Uploader

Welcome to the third chapter of the series “Building file uploaders with PHP 5.” Comprised of five approachable tutorials, this series teaches you the fundamentals of constructing file uploading applications with PHP 5. It also complements the corresponding theoretical concepts with numerous hands-on examples. In this third tutorial of the series, I’m going to show you how to incorporate a brand new error checking module into the file uploading PHP script created in the last article.

TABLE OF CONTENTS:
  1. Creating an Error Handling Module for a PHP 5 File Uploader
  2. Performing file uploads without checking errors
  3. Creating an effective error handling module
  4. Listing the complete source code of the improved file uploading application
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
April 02, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As with many other topics related to the development of modern web applications, PHP makes file uploading a no-brainer process, even for those programmers who are just starting to familiarize themselves with the basics of this popular language. Fortunately, the intrinsic flexibility of PHP permits us to build file uploading applications using a procedural approach and the object-oriented paradigm. Thus, if you're interested in learning how to implement file uploads by way of a few simple functions and classes, then don't waste more time and start reading this article series now!

Now that you're familiar with the goal of this article series, I'd like to spend a few moments rehashing the topics that were treated in the last article, in case you haven't the chance to read it. In simple terms, I explained how to build a rudimentary file uploading application that was given the ability to display useful information about an uploaded file, including its MIME type and size expressed in bytes, and its temporary name and client names as well.

This capacity was introduced into the script in question via the $_FILES super global array, which provides detailed information on each file uploading process performed with PHP. However, it's fair to highlight an important point regarding the use of this array: it also includes a handy element that stores different error codes when a file has been uploaded to the web server. As you may have guessed, it's possible to use this set of error numbers to implement an efficient error handling module that keeps track of the different failures that might occur during a specific file upload.

It's time to dispose of the preliminaries and learn how to create the aforementioned error processing module in a few easy steps. Let's go!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: