{"id":4081,"date":"2017-02-22T04:59:43","date_gmt":"2017-02-22T09:59:43","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=4081"},"modified":"2021-12-08T13:24:03","modified_gmt":"2021-12-08T18:24:03","slug":"increase-max-file-upload-size-wordpress","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/increase-max-file-upload-size-wordpress\/","title":{"rendered":"Here’s How to Increase the Max File Upload Size in WordPress"},"content":{"rendered":"\n
As you go into your forays with WordPress you may encounter some errors that really have nothing to do with you. In fact, let us not call them errors but a language feature built into PHP<\/a> to restrict the sizes of uploaded files and for good reason that is. To fix this we need to look at the max file upload size.<\/p>\n\n\n\n There are several ways in which you can take a peek at this maximum file upload size threshold. For most of them, you need some decent level of technical experience with Apache<\/a> or Nginx<\/a> servers.<\/p>\n\n\n\n In WordPress<\/a>, though there is a much simpler way. In the Admin section, on the menu, you can go to Media > Add New<\/strong> or Media > Library > Add New<\/strong>. You will then be presented with the File upload form and there it will show the maximum file size that you can upload. See the image below.<\/p>\n\n\n\n Depending on the native setting of your host, this figure may be too low especially if you are trying to run a website with downloadable resources like PDF documents or images.<\/p>\n\n\n\n Here we will show you three ways to change the max file upload size.<\/p>\n\n\n\n You can use the .htaccess file found in your WordPress root directory. You can normally access this file by logging into your website’s directories using an FTP client or the File Manager provided by your web hosting provider.<\/p>\n\n\n\n This file is processed on demand every time a visitor accesses your website. Like any file, we recommend you take a backup of this file as it stores very critical configuration information for your website.<\/p>\n\n\n\n All you need to do is add the following lines of code at the end of the file and save it back to the server. The changes will then reflect immediately.<\/p>\n\n\n\n It is also a good idea to increase the max execution time. In the example above it is set to 180 seconds (3 mins). This amount should not be too high as it could cause more problems on badly written scripts.<\/p>\n\n\n\n Depending on how your hosting plan is set up, you might be given access to the php.ini file. In most cases on shared hosting plans, you will not have access to this file. Though we do not strongly recommend doing this, you can create the file and upload it to your website’s root folder. In which case it is better to stick to the .htaccess file.<\/p>\n\n\n\n Should you choose to proceed with the php.ini file in your webroot you will probably want to secure it by adding the following piece of code in your .htaccess file to keep prying eyes away from it.<\/p>\n\n\n\n Now in your php.ini file whether in the correct location or the webroot, you will need to add the following code to the file.<\/p>\n\n\n\n This PHP function can be used to set the value of a given configuration option on demand. The lifespan of this configuration lasts until the end of script execution. Or in short, t lasts for that single request.<\/p>\n\n\n\n To set the appropriate configuration options, you can the following lines of code at the end of the functions.php<\/strong> file for your theme. It can be accessed by going to the WordPress admin page. You can then go to Appearance > Editor<\/strong> and click on the functions.php<\/strong> template on the right.<\/p>\n\n\n\n There you have it. You can now upload larger images or documents without getting errors again as long as you remain within the increased limits.<\/p>\n","protected":false},"excerpt":{"rendered":" As you go into your forays with WordPress you may encounter some errors that really have nothing to do with you. In fact, let us not call them errors but…<\/p>\n","protected":false},"author":1,"featured_media":4082,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,17,20],"tags":[58,136,154,400,424,433,449,452,471,651],"yoast_head":"\n<\/a><\/figure>\n\n\n\n
Three Ways to Change the Max File Upload Size<\/h2>\n\n\n\n
Method 1. Using .htaccess<\/h2>\n\n\n\n
php_value upload_max_filesize 32M\nphp_value post_max_size 32M\nphp_value max_execution_time 180\nphp_value max_input_time 180<\/code><\/pre>\n\n\n\n
Method 2. Using php.ini<\/h2>\n\n\n\n
<Files php.ini>\nOrder allow,deny\nDeny from all\n<\/Files><\/code><\/pre>\n\n\n\n
upload_max_filesize =32M\npost_max_size =32M\nmax_execution_time =180\nmax_input_time =180<\/code><\/pre>\n\n\n\n
Method 3. Using the ini_set PHP Function<\/h2>\n\n\n\n
<?php\n\nini_set( 'upload_max_size' , '32M' );\nini_set( 'post_max_size', '32M');\nini_set( 'max_execution_time', '180' );\nini_set( 'max_input_time', '180' );\n\n?><\/code><\/pre>\n\n\n\n