Upload file size restrictions

Restricting the File size – how it works

The Host may set a limit on the maximum file upload size in the Server environment, which you may override if the Host allows you to. PHP has a setting that it uses to limit the size of the file that it handles in upload. The Host has set that figure in the php.ini based on their particular perceptions and their clientele need. This size appears in Moodle in the Administration > Security > Site Policies > Maximum uploaded file size drop-down combo box. You can change this at any time to suit your site need. In the Course Settings page, there is also a further restriction that can be made. At no time can the Course setting over-ride the Site setting, nor can the Site setting over-ride the php.ini setting, which cannot over-ride the Server setting. The only exception to this rule is that you can manipulate both the Server and the PHP settings, and how to do that is described below.

Modifying the php.ini file

These instructions show you how to change the file upload size by editing your php.ini file.

For the most part these instructions amount to the following. In the file /etc/php5/apache2/php.ini you need to change “post_max_size”, “upload_max_filesize” and “max_execution_time” to values that suit your needs using whatever editor you are used to.

Below are some line by line instructions for various installations of Moodle.

Ubuntu Linux Instructions

These instructions assume that you have installed the standard Moodle package, PHP 5 and Apache 2 via apt-get and left it all as a default install. If you have compiled yourself I presume that you will know where your php.ini files are!

You need to edit the following three settings in your php.ini file located at: /etc/php5/apache2/ Here are a set of instructions to follow line by line.

  • Type “sudo nano /etc/php5/apache2/php.ini”
  • Press Ctrl and W and type “post_max_size”
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type “upload_max_filesize”
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type “max_execution_time”
  • Change the value to 600
  • Press Ctrl and O
  • Press Ctrl and X
  • Type sudo apachectl restart