How to Increase the File Upload Size in Moodle Assignments

To increase file upload size in Moodle, you must change some parameters in web engine and moodle.

Configure php.ini

If you are using php-fpm, you can find file php.ini under /etc/php/{version}/fpm/php.ini. You have to change {version} based on PHP version you used. Example: /etc/php/7.4/fpm/php.ini.

$sudo nano /etc/php/7.4/fpm/php.ini

You have to change these parameters, upload_file_size and post_max_size. You also have to change max_execution_time to extend upload’s time. Example you can set value like this for upload max 50MB and increase execution time to 300 seconds.

upload_file_size = 50MB
post_max_size = 50MB
max_execution_time = 300

Restart php-fpm using this command: /etc/init.d/php7.4-fpm restart

Configure Web Engine

NginX

If you are using nginx, you can use the httpserver, or location block to edit client_max_body_size.

  • Changes to the http block affect all server blocks (virtual hosts).
  • Changes to the server block affect a particular site or application.
  • Changes to the location block affect a particular directory for uploads under a site
    or application.

In this example, we increase limit size to 50MB.

  1. Edit the /etc/nginx/nginx.conf file to increase the limit of the files to upload:
    • http: http { ... client_max_body_size 50M; }
    • server: server { ... client_max_body_size 50M; }
    • location: location /uploads { ... client_max_body_size 50M; }
  2. Save the file and restart the NGINX webserver to apply the changes:
    • systemd systemctl restart nginx
    • sysvinit service nginx restart

Apache2

If you are using apache2, you only have to restart apache2 using command: systemctl apache2 restart.

Change Moodle Settings

1. As an Administrator to ensure that courses created in the future will have the new Maximum upload size, go to Site Administration > Courses > Course default settings and scroll down to Files and Uploads section. Ensure that the Maximum upload size is set to a higher value example 50MB. Again, we recommend Site upload limit.

2. Then, to increase your File Submissions limit, and this is the crucial step, go to Site Administration > Plugins > Activity modules > Submission Plugins > File submissions. Here you can increase the Maximum submission size from its default to a higher value. We recommend Site upload limit but your requirements may differ.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.