Wordpress "file upload has failed to upload due to an error"

First you must assign permission and user:group to the folder:

chown -R : folder
or everything within a folder:
chown -R : *

-R is for recursive, which means all the sub files/directory will get the same ownership

Then for permissions:

chmod -R 777 folder

Also you may have a problem that Wordpress create a new media folder for the month for example under apache ownership but then fail at uploading the file. The fix I found for that is to setup the php.ini config file to: safe_mode = On safe_mode_gid = On

Then restart apache.

< / >