So my new favorite plugin for WordPress is WP-Filebase; a free, easy way to upload files into WordPress that makes those files easy for others to download. While the plugin seems a little daunting at first to manage, it pretty much follows the typical methods other plugins employ such as shortcode. While editing a page or post there is a WP-Filebase button next to the other editing buttons such as “insert link” or “Italic”. Once the basic concepts are mastered, it becomes a pleasure to create categories, upload, and post files for download. There are a ton of other features to categorize, post and track hits with WP-Filebase if you want.
One issue I encountered when using WP-Filebase is that by default the upload size for files in php and WordPress are pretty small, and that the upload size for my entire site had to be increased. When I tried to upload a file with WP-Filebase of any size larger than 2MB, the upload would quit and fail without much information or error messages. When you’re expecting to see “File added”, and instead the page just refreshes without an error, it can be a little frustrating. Here are the steps I took to increase the file upload size:
Login to an ssh session on the server running WordPress.
Before you edit php.ini, it’s always a good idea to make a copy of the original file with a command of something like:
cp /etc/php5/apache2/php.ini /home/jcoltrin/php.ini.original
edit /etc/php5/apache2/php.ini with the command:
sudo vi /etc/php5/apache2/php.ini
Below this paragraph are the php settings to find and change in the vi editor. To find the settings, it can be useful for vi to be in command mode (the vi editor starts in command mode by default). While in command mode, hit the forward slash key /, and then type the keyword, then hit [enter/return]. The vi editor will jump to the first instance of the keyword it finds. You can then simply hit the n key to cycle to the next instance of that keyword. Then hit the i key to go into insertion mode. Now you can hit the delete/backspace keys and use your arrow keys to edit the settings. When you’re done editing, hit the Escape key, then the : key, then type wq, then hit enter. There are ton of other shortcuts, tips and cheats for vi you can find here: http://www.lagmonster.org/docs/vi.html .
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 500
max_input_time = 500
After making these changes, I wanted to be sure they stuck if apache restarts. I did this by restarting apache and then viewing the php settings coming from the web browser itself.
Restarted apache2 with:
sudo /etc/init.d/apache2 restart
Made sure these limits stuck by creating a new file in the root of my apache website files location:
sudo touch /var/www/phpinfo.php
Insert the following line into phpinfo.php (only):
<?php phpinfo(); ?>
Then visited the file by going to http://domainname.com/phpinfo.php
I found that the settings were active and applied successfully by looking at the phpinfo settings website.
I then tested uploads of 12.9MB files which were previously unable to upload and can now upload successfully.
Delete the phpinfo.php you created (you probably don’t want this file hanging around for the world to find.)
That’s it, enjoy using WP-Filebase, and uploading/downloading files of any size to your heart’s content.
If this article helped you, please click on an ad to help pay for hosting and site upgrades. 🙂