File upload size

File upload size

by Dave Cuttriss -
Number of replies: 46

After reading as many of the posts as I could find I asked our ISP (who's pretty good) to adjust the php.ini file to 20MgB upload size.

He's done that and now in the admin area/variables I see my drop down box has gone from a max. of 2MgB to 8MgB (why it's not 20 I don't know)

However when I try to add an assignment the "local" drop down box in the assignment creation has remained at a maximum of 2MgB.

Any ideas? As always appreciated.

Dave

v 1.53+

Average of ratings: -
In reply to Dave Cuttriss

Re: File upload size

by Scott Elliott -
Dave,

PHP will now let you go up to 20MB, but Moodle has a few more controls you should check.  One setting is a sitewide maximum byte size, the other lets you control the maximum byte size for each individual module.

Moodle site wide maximum byte size:
Check the admin->variables maxbytes variable.  It should let you change from the 8MB to 20MB. 

Assignment maximum byte size:
Check the admin->Modules->Assignment settings.  There is one variable there, assignment_maxbytes that will let you go up to the maxbytes you set in the admin->variables area.

Hope this helps!

Scott
In reply to Scott Elliott

Re: File upload size

by Dave Cuttriss -

Thanks Scott: Thats my problem though:

admin->variables maxbytes  shows 8MgB as a top limit but admin->Modules->Assignment  has remained at 2MgB. Should I be looking at the database as well?

The database looks like the image below at the moment:

 Many thanks

Dave

Attachment sqldatabase.jpg
In reply to Dave Cuttriss

Re: File upload size

by Dave Cuttriss -

Even stranger: sometime during the morning ALL my settings defaulted back to 2MgB. Then when I reset the global variable to 8MgB ALL my options now show 8MgB.

However Scott, if you can suggest why I'm only seeing 8MgB when my ISP says he's set it to 20 I'd appreciate it. Also, for interest, if you have any explanation of the phenomena I've described above.

Many thanks

Dave

In reply to Dave Cuttriss

Re: File upload size

by Scott Elliott -
Dave,

Strange indeed.  Have you checked your phpinfo from the admin page?  One theory is that someone is tinkering with the php.ini file.  Maybe it was set to 20MB and some other admin changed it back?  I'm sure hosting companies have more than one admin and you may be the "victim" of changes being done.

Look for post_max_size and upload_max_filesize in your phpinfo data.  If you want Moodle to have a 20MB max upload size, these should be set to 20MB.  (Come to think of it, I'm not really sure about the post_max_size)  Of course, the other parts of Moodle need to have that 20MB set as well.

Scott
In reply to Scott Elliott

Re: File upload size

by Dave Cuttriss -

Scott: many thanks I'll check that out. Sorry for the delay in replying but I've been away. Many thanks

Dave

In reply to Scott Elliott

Re: File upload size

by Emma Hogbin -
SOLVED!!

You must indeed set the following two PHP configuration values: upload_max_filesize AND post_max_size (which refers to the size of a form submitted with method="post" as opposed to method="get" which will always be limited to 300 characters-ish).

If you are editing the /etc/php.ini file directly:
    upload_max_filesize = 20M
    post_max_size = 20M

If you are using Apache's httpd.conf-style php.ini values (which I'm using with virtual hosts so that I don't end up with a huge limit for all my web sites):
    php_admin_value upload_max_filesize 20M
    php_admin_value post_max_size 20M

It is my feeling that the admin instructions on admin/config.php should be updated as follows:
maxbytes: 20MB 10MB 5MB 2MB 1MB 500KB 100KB 50KB 10KB
  This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP setting upload_max_filesize and post_max_size and the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level.
In reply to Emma Hogbin

Re: File upload size

by Peter Hartley -
I have already set these variables to 20M but in IIS I still get only 8Mb maximum upload size for a course.

I suspect this can be solved with Apache but not IIS.
In reply to Peter Hartley

Re: File upload size

by Emma Hogbin -
Have you tried googling "IIS file upload limit"?

I get the following pages which might prove to be useful:
http://www.chrisbunk.com/archives/2005/05/overcoming_iis.html
http://www.aspnetresources.com/articles/dark_side_of_file_uploads.aspx

I hope that helps!
In reply to Emma Hogbin

Re: File upload size

by chhivhorng ly -
Dear Emma,
I'm chhivorng, Now I use Moodle and I need to upload more than 2MB because The Moodle that I use, I can upload Maximum 2MB and I try to change size in php.ini and also I found all data that You share news to other people but I never see what you said.
Now I use Moodle 1.7.1++

please help me,
best regards,
chhivhorng
In reply to Emma Hogbin

Re: File upload size

by chhivhorng ly -
ok,
Now I get success to change size in Moodle.
Because I search all the problem that user in Moodle post the question and answer and after improve myself to do it.
I don't believe i get success.

when I change information alreadly I restart script server.
after I test again, and I get what I want.
thanks to all.

chhivhorng
In reply to Emma Hogbin

Re: File upload size

by Vijay-Kumar Solanki -
Hi All,

I have the same issue with Moodle on OS X.  All variables have been set in the ini files, Max File Size is set correctly in the Admin, and for the Module settings, but when I upload a SCORM is caps off at 2 MB.

Is there something else that I am missing?

TIA - Vijay
In reply to Emma Hogbin

Re: File upload size

by Martin Kucek -
Hi there,

I am also having a hard time to upload large files into Moodle. I did change the php.ini file with upload_max_filesize = 50M and post_max_size = 50M and also on the Site Policies in Moodle I changed the Maximum Uploade File Size to 55000000. I can see in course settings that I can choose the maximum size file upload 50MB and when on the Moodle Upload Page I can see correctly "Upload a file (Max.size 50MB)-->/", but when I am uploading a large file (for example 10MB video file) I am getting an error message from browser "The connection was reset" (see attachment). I wonder if this is actually a Moodle problem or my ISP problem. I can upload smaller files with no problem.

I would appreciate any help,
thanks!
Martin
Attachment connection_reset.JPG
In reply to Martin Kucek

Re: File upload size

by James Moon-Dupree -

MY SOLUTION!

I copied my "php.ini" file from my moodle directory to the directory named "course" and now the "Maximum upload size" drop down menu shows the value put in the "php.ini" file for upload_max_filesize and post_max_size.

Now I have to upload a large file. 

In reply to James Moon-Dupree

Re: File upload size

by Marc Grober -
Please help us to document all the varieties of php.ini experience ;=}
The action you took is consistent with what was necessary under version 4 of php, though apparently some webhosts have done a php5 implementation that may still require this..... there is a web hosts page in the docs and at some point perhaps you could document the details of what you had to do to get this working with your web host....
In reply to Scott Elliott

Re: File upload size

by Eric Stephan -
A NOTE FOR PEOPLE USING NEWER VERSIONS OF MOODLE... who are trying to configure it to allow larger file sizes...

Throughout this thread, people always tell you that the place to change the "maxbytes" moodle variable is by going to admin -> variables.

Well, that is the way that older (pre 1.6?) versions of moodle allow you to change that variable. If you are using a newer copy of moodle, the way to change maxbytes is to go to: Security -> Site Policies -> and look for "Maximum Uploaded File Size," ... which is maxbytes. Change that to 25000000 or whatever. That is in addition to changing the various php.ini and other variables on the server files, that people have discussed in this thread.
In reply to Eric Stephan

Re: File upload size

by Chris Collman -
Picture of Documentation writers
A big Thank you Eric for the reminder. I added a section in MoodleDocs Administration FAQ called Maximum upload file size - how to change it. I took what you posted and went from there. I am sure there is more that can be said.

Since I have a horrible memory, I can not tell you how many times I have forgotten all the ways to set the max file size. I seem to hit things by random: Admin block, php.ini and even the httpd.conf on my localhost before things start to click big grin. A search for Max file size was not helpful in MoodleDocs.

Thanks again for the post. Best Chris
In reply to Dave Cuttriss

Re: File upload size

by Emma Hogbin -
I'm having the same problem. I've set the php.ini value and I know that it is 20M (I even tried setting it as high as 40M), but I'm seeing a maximum value of 8M in the drop down options in the admin area.

v.1.5.3
In reply to Emma Hogbin

Re: File upload size

by Emma Hogbin -
Note: I tried to "force" the setting in the MySQL config table, but for some reason there was still an arbitrary limit of 8M imposed on the file uploads. There must be something hardcoded in the scripts which is forcing this maximum limit.
( I used: update mdl_config set value = '20971520' where name = 'maxbytes' )

When I did a "grep" through the code I found a couple of references to the memory limit for PHP being set to 8M, but ours is 16M, so that shouldn't be it either.
In reply to Emma Hogbin

Re: File upload size

by Crafton Williams -
This link should be helpful: http://www.radinks.com/upload/config.php

More specifically, since you've done the php stuff already, focus on the apache config at the bottom of the page (Assuming you are using apache, of course).

Hope this helps.

Crafton
In reply to Crafton Williams

Re: File upload size

by Emma Hogbin -
Do you mean the "LimitRequestBody" for Apache? By default it allows unlimited uploads and we don't have it set. When I tried to set it (in apache2) I got an error message about it not being an understood term. So the search continues...thanks for your suggestion though!
In reply to Emma Hogbin

Re: File upload size

by Peter Hartley -

Hi

Same here, everything set in php.ini but no change in Moodle. Is this because we are using IIS?

In reply to Peter Hartley

Re: File upload size

by Emma Hogbin -
I don't think the problem is IIS (especially as I've got the problem and I'm using Apache)...I think there's something that's hard coded into the code base. Maybe it's something to do with a built-in limit with ADOdb (the database abstraction layer)? I'm not sure...
In reply to Emma Hogbin

Re: File upload size

by Peter Hartley -

That is possibly the reason, because I can find no errors in the PHP setup and large values do come through in the variables area of Moodle, but the upload value for a course still stays at 8Mb.

From surfing the Internet regarding this, the ADODB stream definitely appears to have limits which cause problems for developers, so maybe this is in fact the Moodle problem, but the stuff is too technical for me.

In reply to Dave Cuttriss

Re: File upload size

by Peter Hartley -

Hi

I think I now know what my problem is – at last! It might help you and others.

When I installed Moodle it was with a PHP ini file with post_max_size set at 8Mb. This puts a value of 8Mb in the mdl_config table for maxbytes. This never changes.

Moodle appears looks at the PHP ini values post_max_size and upload_max_filesize, which it also calls maxbytes, when giving a value for the Variables page.

With uploads it appears not only to look at this maxbytes but also the maxbytes value from the mdl_config table. It then takes the lowest value, which in my case is, of course, 8Mb.

Using a MySQL UPDATE command on mdl_config, changing the maxbytes value to 50Mb, solves the problem, as it is now in step with the PHP value.

The solution is to change the PHP values before installing Moodle, or if you mess up and forget, change the maxbytes in mdl_config table to match you PHP values.

In reply to Peter Hartley

Re: File upload size

by Emma Hogbin -
Yes, I also had to update the database by hand to get my file uploads to work. I agree with your solution of setting the php.ini file values BEFORE installing moodle. OR editing the database if you've changed the setting after the install.
In reply to Emma Hogbin

Re: File upload size

by Huw Smith -
I have done what has been suggested on this page but I am still stuck with 2mb.

I have set post_max_size and upload_max_filesize to 20M in the php.ini file.
I have manually set the maxbytes to 20971520 in the mdl_config.

The php.ini file I edited is located in etc\php5\apache2

Have I missed something out?
In reply to Huw Smith

Re: File upload size

by Emma Hogbin -
Hopefully this is a silly question...but did you restart the Apache server after changing the PHP.ini values? I do this at the command line (as root):
     /etc/init.d/apache restart
(or apache2 if you're using version 2...) 
In reply to Huw Smith

Re: File upload size

by Brian Scardina -
Have you checked the value in the 'maxbytes' field in Moodle's 'mdl_course' and 'mdl_assignments' tables?

If you created the course, or assignment before you modified the post_max_size and upload_max_filesize in your php.ini you might need to manually alter the values in the above tables.

Just a thought...

-Brian
In reply to Brian Scardina

Re: File upload size

by Josh Coombs -

Just to clarify & bit more

This is where I fell down about 2 years ago, you MUST always restart Your IIS/Apache or whatever you are using after you have made changes in your PHP.INI file. Another thing you must also do, if you do not have a very tolerant webhost or have no access to your php settings. You can create a .htaccess file in your root of moodle or (webroot - Risky), and apply your settings with a different argument there.

Best Of luck to peeps who are new to this, and just to remind to make sure both of your php.ini settings post max and upload max are both set to the same value which you want, IE. 20mb, 20mb otherwise one will restrict the other.

In reply to Josh Coombs

Re: File upload size

by Dave Bethany -

I can't believe how DUMB I am. I've been running MOODLE now for a couple of years on my own servers, so I always am shutting down Apache and restarting without thinking. I'm moving it all to a dedicated server, setting it all up, changing the php.ini and no increase in upload size.

THANKFULLY, I read your post before I went absolutely nuts. Yep, restarted it and everything is fine, as always.

DUH,

Dave smile

In reply to Huw Smith

Re: File upload size

by Thomas Robb -
This suggestion might help some people. Very often the need to upload a large file is only a one-time need -- like uploading course backup files after creating a new moodle installation.

In these cases, rather then trying to get Moodle to accept a large file, you can just FTP it into the correct folder in your moodledata file. Uploading a file into any of the numbered directories will make that file available in the directory of the course having that same id number. You can then access it through the course/files admin link and restore it.
In reply to Thomas Robb

Re: File upload size

by Simon Walker -

Thanks a lot Thomas Robb, the only person who will (or at least should) need to upload files of that size on my moodle is me, the admin person. even though it is not backups, but resources, I am the only one. Thanks for that.

In reply to Simon Walker

Re: File upload size

by Dave Perry -
Picture of Testers

I've had a request the other day about being able to upload files of around 30mb so digital art students can upload their raw photoshop files, hence looking at this.

In reply to Peter Hartley

Re: File upload size

by chhivhorng ly -
I checked in the database already I see mdl_config table on maxbyte, it doesn't have value=0,
I can put maxbyte= 60MB, what do you think?

please help me,
In reply to Peter Hartley

Re: File upload size

by chhivhorng ly -
sorry I have to ask you one, in mdl_config table and value field,
I want to know Type of Value field.
because I change in my database I have to get the same problem.

help me,
In reply to Dave Cuttriss

Re: File upload size

by Francisca Wentworth -

Hi:

I have changed the php.ini file: upload_max_filesize = 50M
post_max_size = 50M

I did this in my hosting account files, yet the changes don't appear in Moodle in my course. The max seems to be 10MB.

I also looked at the PHP file under the Moodle Admin block, Server, PHP and it shows max file upload as 20 and post max size as 10MB. In course settings I cannot go beyond 10MB. I would like to be able to upload videos and even 20 MB isn't enough. Any ideas? Help would be appreciated.

In reply to Francisca Wentworth

Re: File upload size

by Sandeep Kankatala -

Hi there...

I want to increase the upload file size (>2 MB). Site is running on a host server. I donot have access to php.ini file and I'm unable to edit the .htaccess file.

I tried creating a new .htaccess file with the following parameters 

php_value post_max_size 22M
php_value upload_max_filesize 20M

But this didn't help me, in fact the website is showing a white page with some error messages. So, i sticked on 2 my old .htaccess file.

Can anyone suggest me a way to increase the upload size.

Thanks.

In reply to Sandeep Kankatala

Re: File upload size

by S. kavita -
Picture of Testers

Hi Sandeep,

After creating a .htaccess file with the following parameters 

php_value post_max_size 22M
php_value upload_max_filesize 20M.

On some system, you will also have to increase the Limit Request body parameter, which is usually found in the Apache Configuration file httpd.conf.

Once these changes have been applied make sure that the Maximum Uploaded file size in

Security>Site policies is set to server limit.

I hope this will help yousmile

In reply to S. kavita

Re: File upload size

by S. kavita -
Picture of Testers

Hi Sandeep,

I am waiting for your reply.

In reply to S. kavita

Re: File upload size

by Sandeep Kankatala -

Hi Kavita

Thanks for your reply. I made that post in this forum an year ago.

Now things have changed, our website is currently hosted on a dedicated server environment. We now have full flexibility in managing the upload limit and I've no problems.

Our current MOODLE version is 2.1.

Thanks again.

Regrads

Sandeep

In reply to S. kavita

Re: File upload size

by S. kavita -
Picture of Testers

Hi Sandeep,

Hey Sorry i was just reading out the entire post and then i found yours. I haven't seen the datebig grin. Sorry once again.

In reply to Dave Cuttriss

Re: File upload size

by Herman Coutinho -

I am hoping if someone out there has a solution to my problem.

I am in process of installing Moodle in the instution I work for. My hosting server allows only 10Mb max upload size through a scrip But if I use FTP client, I can upload unlimited file size.

Our requirement is also to submit video realted project which can be a huge file. Is there any way that I can override the php.ini of my hosting server or is there any other solution.

In reply to Herman Coutinho

Re: File upload size

by Peter Schrader -

Hi all,

I will throw my question in here too. I've configured the PHP.ini file to accept 50 meg files. I've checked the appropriate htaccess files to have a LimitReuqestBody of 0. We run into upload probelms when dealing with large files. Although the limit is 50, we can't work with files even if they're 35 megs.

What am I missing? Is there a hard coded limit to PHP? Is there a caching limit/issue? Any help or guidance is appreciated.

PG