php.htaccesssilverstripefilesize

Increase max file upload size for SilverStripe site


I am working on increasing the max upload file size for a SilverStripe site as I want the new limit to be 20 MB instead of 2 MB. I have placed this line of code in the root .htaccess file for the project:

php_value upload_max_filesize 20M

This works to some extent. It has increased the upload size limit, but only to 8 MB. I removed this line of code and tried uploading a large file again and the "file size exceeds 2 MB" error returned. So, what I have in place does work but only increases the file size limit to 8 MB.

I have been reading that there can be a php.ini file included in the project to increase the file size limit as well, but I am wondering if there is a way to do it through just the .htaccess file?


Solution

  • The reason for this problem is because you've not set your post_max_size. The post_max_size defaults to 8mb. So you need to do the following:

    php_value upload_max_filesize 20M
    php_value post_max_size 50M
    

    You can obviously edit the post_max_size to something more suitable to what you need.