Source for file upload_max_filesize.php

Documentation is available at upload_max_filesize.php

  1. <?php
  2. /**
  3. * Test Class for upload_max_filesize
  4. *
  5. * @package PhpSecInfo
  6. * @author Ed Finkler <coj@funkatron.com>
  7. */
  8.  
  9. /**
  10. * require the PhpSecInfo_Test_Core class
  11. */
  12. require_once('PhpSecInfo/Test/Test_Core.php');
  13.  
  14. /**
  15. * The max recommended size for the upload_max_filesize setting, in bytes
  16. *
  17. */
  18. define ('PHPSEC_UPLOAD_MAXLIMIT', 1024*256);
  19.  
  20.  
  21. /**
  22. * Test Class for upload_max_filesize
  23. *
  24. * @package PhpSecInfo
  25. */
  26. class PhpSecInfo_Test_Core_Upload_Max_Filesize extends PhpSecInfo_Test_Core
  27. {
  28. /**
  29. * This should be a <b>unique</b>, human-readable identifier for this test
  30. *
  31. * @var string
  32. */
  33. var $test_name = "upload_max_filesize";
  34.  
  35. var $recommended_value = PHPSEC_UPLOAD_MAXLIMIT;
  36. function _retrieveCurrentValue() {
  37. $this->current_value = $this->returnBytes(ini_get('upload_max_filesize'));
  38. }
  39.  
  40. /**
  41. * Check to see if the post_max_size setting is enabled.
  42. */
  43. function _execTest() {
  44.  
  45. if ($this->current_value
  46. && $this->current_value < $this->recommended_value
  47. && $post_max_size != -1) {
  48. return PHPSECINFO_TEST_RESULT_OK;
  49. }
  50.  
  51. return PHPSECINFO_TEST_RESULT_NOTICE;
  52. }
  53. /**
  54. * Set the messages specific to this test
  55. *
  56. */
  57. function _setMessages() {
  58. parent::_setMessages();
  59. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_max_filesize is enabled, and appears to be a relatively low value.');
  60. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'upload_max_filesize is not enabled, or is set to a high value. Are you sure your apps require uploading files of this size? If not, lower the limit, as large file uploads can impact server performance');
  61. }
  62.  
  63. }

Documentation generated on Mon, 26 Feb 2007 10:50:10 -0500 by phpDocumentor 1.3.0RC3