2007/10/29

How to on Maximum upload size

One of the most frequent problems in Moodle is setting limit for upload files. Sometimes it depends on settings on your webserver and we should cover these settings here.

Many teachers and students faced to bothersome warning when they tried to upload some material to Moodle course. Teachers can try to zip their materials before they try to upload them to course and there Moodle can unzip them for teachers. Teacher also should look for upload size limit in Course settings, because Moodle allow different limit for every course.



But if there is only some small value and teacher want upload bigger files, he have to ask administrator to set the limit higher.

First thing Moodle administrator should check is main upload limit settings for whole site in Site Administration > Site policies.



As you may see on the picture, there is set 0 for maxbytes value. This means no limit. But only no limit meant from moodle administrator. Administrator might want to limit users to disallow them upload too large files (due some bandwidth problems, not enough harddisk place etc.) So administrator should check this place, if it doesn't contain some unwanted limit.

But you may see i highlighted two anothers words. post_max_size and upload_max_filesize. These settings are true limit holders, beyond them even administrator cannot set Moodle upload limit higher, even if he set no limit.

These settings are given by your server php.ini file. If you are admin of your webserver where you run Moodle you might change them by yourself. Or just ask person with root rights for your server to change them for you.

You might be asking, what are these two variables about. So upload_max_filesize is a max limit of uploaded files. You might upload more than one file with single form on another websites, but this is not Moodle case, i think there is only one input of file type everywhere. (You can upload how many files you want, i meant you may upload only one file by one submitting of the form.)

post_max_size is limiting how much posted data can your script digest. So some additional data might be added to file size of uploaded file. You should therefore set slightly higher value in post_max_size than upload_max_filesize.


Don't forget to restart your webserver, after you alter higher mentioned variables!!

There is another way if you don't have root access to your webserver and php.ini file (on some servers there are more than one php.ini file, you will find which one to modify when you will run yourmoodle/admin/phpinfo.php in browser - here you can find very useful information about settings on your server. post_max_size and upload_max_filesize are mentioned here too!



You may try to create special file .htaccess (there is really no extension, trust me ;-) ) with lines

php_value post_max_size 22M
php_value upload_max_filesize 20M

And place it to root directory of your moodle. (Right there where is config.php of your moodle located). If you encounter some error, delete this file. This error means your server is not allowing you to alter settings with .htaccess files (it's for security reason and you will have to ask server administrator to help you solve upload file size problem).

I know today's post seamed little too difficult. If you are lucky and you have some person who is taking care of your webserver, just ask him politely to set these variables for you, he might know better what he should do ;-). If you are in this on your own, Good luck to you and feel free to contact me if you encounter a problem.

3 comments:

Anonymous said...

thanks - this was helpful and quite comprehensive. Maia

Dolfa said...

I am glad this post was helpful for you :).

Anonymous said...

This was really useful - thanks a million.

On Moodle's newer versions, the site-policies is hidden under a submenu (Site-admin / security / sitepolicies).