Wednesday, October 14, 2009

increasing file upload size in wordpress.

I have faced a problem regarding uploading of big images in wordress. In php 5.2.5, it has change it's configuration file structure. Now it sets access level to it's directives. The levels are 7,4,2,1. And for this access control now we can't modify every configuration settings by ini_set() function in runtime.

Those that have access level 7, can be modified by ini_set() function. And some can be set using .htaccess file. And some need to have admin level access.

If you want to use .htaccess file then you need to paste the following code into you .htaccess file.


php_value upload_max_filesize 100M
php_value post_max_size 105M
php_value max_execuetion_time 300
php_value memory_limit 64M


you need to set post_max_size to larger size than upload_max_filesize, as there could be multiple upload field in a form.

Now, while you are using .htaccess file, the server may not support the directive changing command that you are trying to modify. I mean your server need to have AllowOverride property On for the specific directive that you are trying to modify. you need to contact with your hosting server support.

There is another way, you can create a php.ini file with the configuration directive that you want to change. For image uploading in wordpress, you can create the following php.ini file.


;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

upload_max_filesize = 100M;
post_max_size = 105M;
max_execution_time = 300;

;End:


you need to place it under the wp-admin folder.






List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide