An Introduction to the WordPress Filesystem API http://www.sitepoint.com/introduction-to-the-wordpress-filesystem-api/