The size of files available for upload through the Contao File Manager is controlled by two possible settings - the Contao System Settings for upload and the file upload size limit in the PHP.INI file. By default the limit in the PHP.INI file is set to 128 MB and a default installation of Contao will have the setting at 2 MB. The following article shows you the error you will encounter if you exceed this limit, and how to fix it in both the Contao System Settings and PHP.INI file.
Increasing the Contao File Manager Upload Limit
During the upload of files with the Contao File Manager you may see the error message at right.
- Login to the Contao Back end as an Administrator.
- In the left hand section labeled Back end modules, scroll down until you find SYSTEM. Click on SETTINGS and it will launch the Contao System Settings screen.
- In the SETTINGS screen, scroll down until you find the UPLOAD SETTINGSsection. Click on the arrow at left in order to expand the section if you need to have it expanded.
- Look for the field labeled MAXIMUM UPLOAD FILE SIZE. Click in the field and change the file size which uses bytes as the units. By default, the value is set to 2048000 bytes (2 MB). If you want to calculate to the exact byte, multiply 1024 (1 MB) times the number of megabytes you want to use. For example, 4 MB would 4096000 bytes.
- Click on SAVE AND CLOSE in the bottom left hand side of the SETTINGS window.
If you are attempting to exceed 128 MB, you will need to find the default PHP.INI file and change the FILE UPLOAD size that is set in the file. Web Hosting Hub includes a default PHP.INI file at the root PUBLIC_HTML folder. You can edit this file using the Cpanel File Manager or your by downloading with a FTP client and then editing the file with a text editor. After editing the file you would need to re-upload the file and replace the old PHP.INI with the modified one. For more information on editing through Cpanel, go to Using the Cpanel File Manager. You can also find information using Notepad ++'s FTP solution here: Using Notepad++ to Modify a File.
Here is a summary of the steps to edit the PHP.INI file:
- Access the PHP.INI file in your web host using Cpanel File Manager or through FTP. By default, the file is often at the root of the primary domain - public_html.
- Open the file with the editor and look for the following section:
- Look for the UPLOAD_MAX_FILESIZE line and change the limit there. Remember that you will still need to be set in the Contao System settings.
- Click on SAVE in order to save your settings.
This will change the size of the files allowed to be uploaded through the File Manager and the Contao File Manager. Bear in mind that while file sizes can be used, the acutal size used should be limited per your server performance needs. You do not want to be loading 16 MB graphic files, and expecting the performance of the server to optimal at that poin. Keep the file sizes small and there should be no issues with the File Upload sizes.