Blog » SilverStripe: Fixing the "file size error" given by the Uploadify module
SilverStripe: Fixing the "file size error" given by the Uploadify module
DataObjectManager and Uploadify are great. UncleCheese's modules provide an intuitive way to easily attach objects to a page in the CMS and also to manage the file upload process. Normally these two modules provide no problems for me, but lately I've encountered two issues with the Uploadify module - mainly due to host server settings.
It's all fun & games until someone loses an eye
If you're on a shared host (or even if you're not but end up loading larger files via Uploadify) you may run into the "file size error" message in the uploadify dialogue
In plain English this means: "The file you're trying to upload is larger than the maximum upload filesize currently allowed by your PHP settings".
The first thing you need to do is see what settings Uploadify is using. You can see this by adding
to your mysite/_config.php file
Then, when you use the Uploadify dialogue again you can see the current file upload size limit that Uploadify is using by looking at the sizeLimit value.
This will let you know whether you need to increase your file upload size limit in your PHP settings. If you do, you can do this one of three ways:
- add an ini_set() call in your _config.php (didn't work for me)
- add a php_value directive in your .htaccess file (didn't work for me)
- add a php.ini file in the directory that Uploadify is being called from (but which one is that??)
I added print_r($_SERVER, 1) to the Uploadify debug messaging. From the server vars I found that Uploadify was being called by the URL request being routed through /sapphire/main.php, so I placed the following php.ini file in the sapphire directory:
upload_max_filesize = 30M
post_max_size = 30M
max_input_time = 120
max_execution_time = 120
Voila! My upload_max_filesize value went from 2MB to 30MB and I could then upload large files without errors.
Took me a while to figure this out - hope it can also help you.