PHP Directives Related to (Large) File Upload


Preferences - Do not show ads

Directives are used to configure the PHP engine. They are placed in PHP's configuration file php.ini. There are a number of directives that are related to file upload and they may be useful to you (very often you can stick with the default values and do not need to modify them). The following table lists the directives and provides a brief description of each of them:


PHP Directive

Brief Description

Example

file_uploads

  • It specifies if file upload is allowed in PHP.

  • The default value is On.

  • You may need to contact the administrator to make sure the file_uploads directive is set to On.

file_uploads = Off

upload_tmp_dir

  • It specifies the directory in which uploaded files will be stored temporarily.

  • It is not specified by default.

  • If it is not specified, the PHP engine will use the system default temp directory.

upload_tmp_dir = "/temp"


Here are some PHP directives that you may have to change in order to support large file upload. By default, files that are larger than 2MB will be rejected.


PHP Directive

Brief Description

Example

upload_max_filesize

  • It specifies the maximum file size (in bytes) that the PHP engine will accept.

  • The default value is 2M (2 * 1048576 bytes).

upload_max_filesize = 4096

post_max_size

  • It specifies the maximum size (in bytes) of HTTP POST data that is permitted.

  • The default value is 8M (8 * 1048576 bytes).

  • Make sure this value is greater than that of the upload_max_filesize directive.

post_max_size = 10M

memory_limit

  • It specifies the maximum amount of memory (in bytes) that is allowed for use by a PHP script.

  • The default value is 16M (16 * 1048576 bytes).

  • This value should be greater than that of the post_max_size directive.

memory_limit = 20M

max_input_time

  • It specifies the maximum amount of time (in seconds) that is allowed for each PHP script to receive the client's HTTP request.

  • The default value is 60.

  • If you need to support large file upload, you may need to increase this value to prevent timeouts.

  • Note that some users may have a slow connection. You have to take that into account.

max_input_time = 90

max_execution_time

  • It specifies the maximum amount of time (in seconds) that is allowed for each PHP script to execute.

  • The default value is 30.

  • If you need to process large uploaded files with PHP, you may need to increase this value to prevent timeouts.

max_execution_time = 60


Preferences - Do not show ads


Page 4 of 11 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






Upload File from WAP Cell Phone - Table of Contents Upload File from WAP Cell Phone - Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page