Increase Max Upload File Size in WordPress

Sometimes, you need to upload a large file to your site, and the default 8mb limit in WordPress isn’t enough. When I tried to upload a file I got

Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes)

I attempted to change my limit directly on my server, then in the .htaccess file and then in wp-config.php but neither change worked for me. Then I came across this little snippet by Word Impressed which actually worked and allowed me to increase my max upload file size limit. All you need to do is create a php.ini file and upload it into your /wp-admin folder. Then add the following:

memory_limit = 32M upload_max_filesize = 32M post_max_size = 32M file_uploads = On