Maximum file upload size in Moodle


In Moodle 2.X, by default maximum upload file size is 2MB. How do you increase the max upload size for Moodle?

The solution which you see here apply to you if your Moodle is running in a Shared Hosting.  Right now my Moodle site is hosted at Bluehost.com and using cPanel.

1. Use your FTP client and connect to your Moodle server and open public_html folder.  In public_html folder you will find a file called php.in.  Click on php.in file and press edit button.

Editing PHP.INI fine in Moodle

2.  The php.in file which you open will have one line.  You need to add

upload_max_filesize = 20M
post_max_size = 20M

to your php.in file and save the file to your server.  If you want to increase the file size just change the numbers

Upload Max file Size  in Moodle

3.  Now login to your Moodle site as administrator
Go to Site Administration | Security | Site Policies | Maximum Uploaded file section

This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP settings post_max_size and upload_max_filesize, as well as the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level. If ‘Server Limit’ is chosen, the server maximum allowed by the server will be used.

Click on the drop down list and you should see your new maximum uploaded file size in Moodle.  Select your new maximum uploaded file size and click OK


maximum_uploaded_file_moodle

4. Also go to Course Administration | Edit Settings|  if you don’t see the new maximum uploaded file size , just click on the dropdown and apply new size 

edit_course_settings_maximum_upload_size

Your site configuration might not be secure. Please make sure that your dataroot directory in Moodle


Your site configuration might not be secure. Please make sure that your dataroot directory (/home3/parent/public_html/datarootdir) is not directly accessible via web.

Above is a typical message you get when you login into Moodle if it’s installed  in shared hosting.

Your site configuration might not be secure. Please make sure that your dataroot director

How do we block dataroot directory not directly accessible via web? 

We have to move dataroot directory from public_html folder to the root of your web hosting. Here are the instructions what you have to do to move the dataroot folder away from public_html in Moodle.

1. Connect to your web server using any FTP client (I am using WS_FTP) and go to public_html folder.

public-html-moodle

2. In public_html folder find dataroot folder.  Download this folder to your desktop or any where in your computer. You can also copy and past the folder in the root folder but it take long time. Do not delete the datarootdir in public_html folder NOW.

datarootdir-in-moodle

3. Now move datarootdir to your root directory. Root directory is folder/

move-datarootdir-to-root-folder

4. Once you moved datarootdir folder into Root directory, click on public_html folder and edit config.php file.  We need to change the path so that it can point to new location of datarootdir folder.

open-config-php

5.  This is how your config.php file will look like.  Where it says $CFG—>dataroot = “/home/root/public_html/datarootdir’; you need to change this to “/home/root/datarootdir’.  Just remove /public_html  line  and save the file.

remove-public-html

 

6. Now if you log back into Moodle, you will not see

Your site configuration might not be secure. Please make sure that your dataroot directory (/home3/parent/public_html/datarootdir) is not directly accessible via web.

message anymore. now you can go to your public_html folder and delete your datarootdir