note 100728 modified in features.file-upload by danbrown

From: Date: Sun, 23 Jan 2011 16:59:44 +0000
Subject: note 100728 modified in features.file-upload by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176137@lists.php.net to get a copy of this message
Sometimes you may get empty $_FILES and empty $_POST. If this happens, this is probably because the posted file size exceed the post_max_size php ini directive value. You could use something like this to handle it in your form, here it is : <?php // The form isn't misbehavin then… if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { $poidsMax = ini_get('post_max_size'); $oElement->addError("fileoverload", "Your feet is too big, maximum allowed size here is $poidsMax."); } ?> --was-- As said before on this page, sometimes you may get empty $_FILES and empty $_POST. If this happens, this is probably because the posted file size exceed the post_max_size php ini directive value. You could use something like this to handle it in your form, here it is : <?php // The form isn't misbehavin then… if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { $poidsMax = ini_get('post_max_size'); $oElement->addError("fileoverload", "Your feet is too big, maximum allowed size here is $poidsMax."); } ?> http://php.net/manual/en/features.file-upload.php

« previous php.notes (#176137) next »