Contact Form Processing Products - for all your needs

FormMail • Form Encryption • Hosted Forms

MAX_FILE_UPLOAD_SIZE Setting

This page documents the MAX_FILE_UPLOAD_SIZE configuration setting in FormMail.

Type Of Setting

MAX_FILE_UPLOAD_SIZE is an OPTIONAL setting, which means...

OPTIONAL : you can change this setting if you need to, but the default value is fine for most circumstances.

Précis

Sets the maximum file upload size.

Description

Set MAX_FILE_UPLOAD_SIZE to the maximum size you want to allow for a file upload. Setting this to 0 means that the HTML form and/or the PHP configuration (upload_max_filesize) on your server specify the limit.

Specify MAX_FILE_UPLOAD_SIZE in kilobytes. For example, "4" means 4 kilobytes, which is 4096 bytes (4 * 1024).

You can set this in the HTML form (MAX_FILE_SIZE), but it's easily overridden by an attacker.

You can also set this in the php.ini or httpd.conf if you have access to these files. If you don't have access to these files, then you cannot successfully set a larger size with MAX_FILE_UPLOAD_SIZE (these files provide a hard upper limit that a PHP script cannot override).

But if you want a smaller size than that specified in php.ini and httpd.conf then you can set MAX_FILE_UPLOAD_SIZE to that smaller amount and FormMail will enforce the smaller limit.

Very Large Files

If you need to allow users to upload very large files, there are several settings inside PHP that can affect this operation:

  • upload_max_filesize
  • max_input_time
  • post_max_size
  • memory_limit
  • session.gc_maxlifetime

Your hosting provider controls these settings, but may provide a way for you to override them.

Default Value

From version 9 onwards:

$MAX_FILE_UPLOAD_SIZE = 0;

Before version 9:

define("MAX_FILE_UPLOAD_SIZE",0);

Examples

From version 9 onwards:

$MAX_FILE_UPLOAD_SIZE = 512;  // half a megabyte

Before version 9:

define("MAX_FILE_UPLOAD_SIZE",512);  // half a megabyte

See Also