the uploaded file exceeds the upload_max_filesize directive in php.ini

How to increase upload file limit

In previous chapter we covered how to upload file in PHP script, this only covers single file upload with default upload limit size defined by PHP, which is generally 3 MBs. However there will be situation where you are offering your visitors to upload files and desired limit is beyond the default limit.

This chapter will take you through how to increase upload file limit in PHP.ini file.

Increase upload limit in php.ini

In order to increase limit of upload file size you have to work with php.ini configuration file. Please follow these steps.

  • 1-      Open php.ini file in a text editor of your choice
  • 2-      Find this “upload_max_filesize” directive in your php.ini file
  • 3-      You will see something like this overall

;;;;;;;;;;;;;;;;

; File Uploads ;

;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.

; http://php.net/file-uploads

file_uploads=On

; Temporary directory for HTTP uploaded files (will use system default if not

; specified).

; http://php.net/upload-tmp-dir

upload_tmp_dir=”F:\xampp\tmp”

; Maximum allowed size for uploaded files.

; http://php.net/upload-max-filesize

upload_max_filesize=3M

Now change the upload_max_filesize to your required size; from 3M to required, 10M for example for 10 MBs.

It is most probable that you need to start your web server (Apache) in order to see change is occurred.

Also See: How to upload files using PHP script