News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Cormac's Blog:
Fast server-side rejection of large image uploads using $_FILES
August 29, 2008 @ 12:58:04

Recently on his blog Cormac has posted a quick little tutorial on making things a bit faster when rejecting file uploads in PHP that are just a bit too large.

Discovered today you can report to a user if the file(s) he/she is uploading is too large without having to wait for the file to finish uploading by checking $_FILES.

The key is the "error" field in the $_FILES array that actually returns its value before the upload is finished if the size of the file is larger than the MAX_FILE_SIZE set in the POSTed information of the form. The Content-length header is sent before the actual payload (the file upload data) so PHP can interpret that before the upload starts and kick it back with an error if it's too large.

0 comments voice your opinion now!
file upload maxfilesize contentlength fast tutorial


blog comments powered by Disqus

Similar Posts

PHPit.net: PHP5 Class Basics, Part 1

PHP-Tip-a-Day: PHP Tutorial: The Allegory of The Factory Pattern

Secunia.com: CMS Mundo SQL Injection and File Upload Vulnerabilities

Giorgio Sironi's Blog: Never write the same code twice: Dependency Injection

Ruben Vermeersch's Blog: Integrating Zend Framework and Doctrine


Community Events





Don't see your event here?
Let us know!


tips podcast interview community zendserver language api bugfix symfony introduction framework deployment release voicesoftheelephpant series laravel developer conference list library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework