Forums | Mahara Community

Support /
Increase Max file upload sizw


anonymous profile picture
Account deleted
Posts: 4

17 March 2011, 11:41

Hi

I have searched everywhere and just cannot increase the max file upload size which seems to be set at 2MB. I have tried increasing the values in the htaccess but that does not seem to work. Is there anyone that can point me in the right direction.

thank you

David

anonymous profile picture
Account deleted
Posts: 27

17 March 2011, 14:41

Hi David,

I ran a quick grep of the code base (was curious also). Found the following in lib/mahara.php.

/**
 * Determines maximum upload size based on quota and PHP settings.
 *
 * @param  bool $is_user whether upload size should be evaluated for user (quota
 is considered)
 * @return integer
 */
function get_max_upload_size($is_user) {
    global $USER;
    $maxuploadsize = min(get_real_size(ini_get('post_max_size')) - 4096, get_real_size(ini_get('upload_max_filesize')));
    if ($is_user) {
        $userquotaremaining = $USER->get('quota') - $USER->get('quotaused');
        $maxuploadsize = min($maxuploadsize, $userquotaremaining);
    }
    return $maxuploadsize;
}

Looks like it is controlled by PHP settings. My settings differ (for dev reasons) I have the following in the mahara web root .htaccess file

php_value upload_max_filesize 50M
php_value post_max_size 50M

HTHs

 

Cheers,

Alan

anonymous profile picture
Account deleted
Posts: 4

18 March 2011, 9:35

Thanks for your reply. I have tried changing the .htaccess and also adding a php.ini file and neither work the 2MB max just stays. I have other web sites on the same shared server where chaging these settings work, they just will not work with Mahara. Maraha is excelent for what I need apart from this issue which will stop me using it unless I can find the solution.

anonymous profile picture
Account deleted
Posts: 4

18 March 2011, 10:24

I have solved thanks for your help

18 March 2011, 10:48

Bravo.

Could you tell here what you did to solve your problem, so your solution may help some future Mahara users.

Thanks in advance, and have fun with Mahara.

-dajan

steve P's profile picture
Posts: 122

17 March 2011, 19:54

You probably need to change the relevant settings (post_max_size, upload_max_filesize) in php.ini on your web server. These are usually 2MB by default.

18 March 2011, 3:16

Dear DAvid,

I confirm what has been said here before. You may edit the value of

  • post_max_size
  • upload_max_filesize

in you php.ini file or, whether you want to have encrease this limit only for mahara and not the eventuel other services you host on the same server, in a .htaccess file in your mahara folder.

To be sure these new setting effect your server, at least stop/start or restart your apache server. Or restart your machine to clear all caches.

-dajan

Ruslan Kabalin's profile picture
Posts: 146

18 March 2011, 4:28

Those two php directives are the only ones that control maximum upload file. However, depending on your apache configuration, .htaccess might be ignored, then same settings set in php.ini will be used instead.

8 results