How do I fix “Sorry, this file type is not permitted for security reasons”

This error is thrown in _wp_handle_upload function. As you see from line above it will be thrown when WordPress can not figure it out which file type or file extension you are trying to upload. Try to debug $type and $ext variables to find out why your .png file is not recognized correctly.

My guess is that your webserver/WordPress is not recognizing png mime type correctly. Thats why $type variable is false|null|0.