So you have been trying to upload that beautiful high definition picture of yours, but you’re constantly getting a message that the uploaded file exceeds the upload_max_filesize directive. Sounds relatable? If yes, don’t worry for we have the solution for it.
Several people often face this difficulty while uploading files to their sites. And they tend to blame the theme and the plugin developers for it. However, the cause for this problem lies not in the theme or the plugin, but in the php.ini file of their web server.
What is Max File Size
In a server environment, the host sets a limit on the maximum file upload size. PHP has a setting to limit the size of the files that are uploaded to the server. This limit however, can be overridden easily as and when required to suit your site’s needs. All you need to do is change the max file size limit in your server’s php.ini file.
Here we show you how exactly to do that. If you’re working in a local environment, you must have either WAMP, XAMPP or MAMP (as applicable) installed in your PC. To know more about installing and configuring WAMP in your PC read this article. Here we will primarily be talking about changing the max file size limit with reference to a local WampServer environment.
If you’re working on a shared hosting, you will have to contact your hosting provider to gain access to the php.ini file.
Let’s Get Started
When you’ve successfully installed WampServer to work in a local environment, follow the steps given below.
When you click on the WampServer tray icon in the taskbar, a dialog box will appear.
Navigate to PHP > php.ini file.
If you are on a hosted server, then you will probably need to refer to your administrator or distribution manual for the correct location of the php.ini file.
When you open your php.ini file, press CTRL + F to view the Find box.
Type post_max_size in Find, and click on Find Next.
As soon as you click on Find Next, you will be able to locate post_max_size in your php.in file. Change this limit to a suitable value. Here, I changed it from 2MB to 8MB.
After you’re done with the above steps, go to File > Save and close the php.ini file.
Now you need to restart your server’s services. If you’re using WampServer, click on its tray icon in the task bar and click on Restart All Services.
Verifying That Our PHP File Size Limit Has Increased
Once you restart your server’s services, open a web browser. In the address bar, type localhost/phpmyadmin.
Click on Databases. Type a word of your choice in Create New Database (Here, I chose ‘mstoic’). Then click on Create.
Voila! Your Database has been created successfully. You will get a message as shown below.
Now, go to Imports tab on the same page. You can see the WampServer’s updated Upload Size Limit. (Here, the maximum limit which has been set is 8,192KiB which is approximately equal to 8Mb)
Congratulations! Now that you’ve tackled all your problems related to this, enjoy downloading and uploading files in one go!