Home arrow PHP arrow Retrieving Information on Selected Files with a PHP 5 File Uploader

Retrieving Information on Selected Files with a PHP 5 File Uploader

The initial script in the first tutorial of this series lacked some important features, such as the implementation of an effective error handling module and the ability to check the MIME type and size of the file being uploaded. In this second installment of the series, I’m going to improve the logic of the script from the first tutorial to provide it with the capacity to retrieve useful information concerning the entire file uploading process.

TABLE OF CONTENTS:
  1. Retrieving Information on Selected Files with a PHP 5 File Uploader
  2. Reintroducing a previous hands-on example
  3. Retrieving useful information on the uploaded file
  4. Listing the complete source code of the improved file uploading application
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
March 26, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As you know, nowadays the web has plenty of sites that provide visitors with the ability to easily upload their files to a web server. And this phenomenon, for bad or good, is a crucial part of the so-called “social web.” But regardless of what you may think of these kinds of websites, in all these cases, there’s a backend application that performs these file uploads via the HTTP protocol.

However, there’s no need to build a huge social website to implement a file uploading mechanism. And you, as a PHP developer, are probably well aware of this. Handing file uploads with PHP is one of the most popular topics to learn these days, and that’s the reason I decided to write this article series. In its different tutorials, you’ll learn the basic concepts required to build a file uploading application with PHP 5, first by using a procedural approach and then via the object-oriented paradigm.

Now that I've introduced you to the main subject of this group of articles, I’d like to quickly refresh the concepts that I deployed in the first part of the series, in case you didn’t have the chance to read it. In simple terms, I explained how to create a basic file uploading script in PHP 5 by using a combination of the “move_uploaded_file()” PHP native function and the $_FILES superglobal array.

Naturally, first it was necessary to construct a simple front-end composed of a typical web form that provides users with an intuitive mechanism to browse files in the client machine, then select one of them, and finally upload it to the server via the aforementioned PHP script. However, this was only an introductory approach for building a file uploader with PHP 5.

As you know, small moves can go a long way, so let’s continue learning how to handle file uploads with PHP 5. Let’s get going!



 
 
>>> 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 2 - Follow our Sitemap

Dev Shed Tutorial Topics: