5 MB photo??

5 MB photo??

by Pablo Etcheverry -
Number of replies: 7
Picture of Core developers
Hi!
I've noticed something that generates some laughs among students... If you set maximum size=5MB in php.ini to let teachers upload big content, that same limit will appear in the maximum size for your photograph! Some students have even succesfully tried uploading BIG photos.
I think this should have a separate size control, but can't figure out how...
Cheers,
Pablo
Average of ratings: -
In reply to Pablo Etcheverry

Re: 5 MB photo??

by James Twing -
I don't know of a webserver-based mechanism by which you can user-determine the maximum file size allowable as a form upload.

A quick-and-dirty fix might be to just change the message displayed, so that while large uploads are -allowed-, they aren't 'advertized'.

Another possibility might be to use PHP scripting to find out the size of a file -after- submission, and then reject and immediately delete the file if it is larger than a pre-determined size, as well as provide the requisite feedback to the user attempting to upload. While it wouldn't completely prevent large file uploads, it would effectively render them useless to users whose settings don't allow large uploads.

Anyone else?

In reply to Pablo Etcheverry

Re: 5 MB photo??

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Someone has actually sponsored me to work on exactly this problem and it should be in CVS within days. There will be a site limit, a course limit, and a module limit (forums, assignments). The smallest one wins.

A quick workaround that I use on this site is to place a .htaccess file in the moodle/user folder containing:

php_value upload_max_filesize 1M
php_value post_max_size 1M
In reply to Martin Dougiamas

Re: 5 MB photo??

by James Twing -
Naturally, the site limit will not be able to surpass the limit set in php.ini, right?

Or, to put it another way, if the php.ini max form upload allowable is set to 5MB, and Moodle's site limit is set to 10, users would still only be able to upload a maximum of 5MB, right?
In reply to James Twing

Re: 5 MB photo??

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, I'm pretty sure server settings CAN be overridden locally, although the PHP settings and Apache's LimitRequestBody have to be in a .htaccess file (so they get read BEFORE PHP scripts are executed). This has been my experience, though it seems (after looking at the docs) that I could be wrong here - even though the setting is changed it might not have an effect on the actual behaviour.

Anyhow, yes, the settings I'm adding will be limited by whatever the "external" setting is in php.ini or .htaccess etc
In reply to Martin Dougiamas

Re: 5 MB photo??

by Ger Tielemans -

Is this 5MB limit also there for download?

  • We have 2MB as limit to keep control,
  • Bigger files I - as Moodle Man - and only I can "bring in" using a backdoor:
  • We advise not to use big files like movies, but cut them in educational pieces
  • Other support we offer is to help them use size-reduction-tools.

We do https:// so I use (the free tool) Winscp3.0 for ssh:

  • I can choose in ths tool for a good old windowscommanders interface
  • I can edit php and other files on-line on the server, using a built in editor (only missing linenumbers)
  • And I can store sessions so, keeping a session for just entering the files from my local-store to the moodle-files-directoires (I can do directory compare)
  • All the other users have to use the frontdoor, to keep the system integrity ok...
In reply to Martin Dougiamas

Re: 5 MB photo??

by Pablo Etcheverry -
Picture of Core developers
Hi!
I did that and "the song remains the same". I put a .htaccess file in /user reading:
php_value upload_max_filesize 1M
php_value post_max_size 1M
...but the Maximum Size shown is still 5MB. Maybe I'm not able to upload that size (I didn't test that) but even if these two lines limited the file size to 1MB, it's not a nice option that it looked as if I could. smile Pablo
In reply to Martin Dougiamas

Re: 5 MB photo??

by Stephen Henneberry -
I uploaded an .htaccess file just as you mentioned, but there seems to be no change. Somehow, the maximum file size for user photos on my site is 20 MB! surprise This can't be the default value. I must have done this somehow... Any ideas???