I got this error message when WordPress user try to upload document using Add Media option.
“You don’t have permission to attach files to this post”
I searched about this issue and found few solutions. Sharing all of them with you so try all, you might get one working for you. 🙂
User role given to user might be corrupted. If you are aware with any Role editing plugin, install it and assign below role to user. User need edit_post role along with below options.
If you are developer and have access to PHP files, you can add below code in functions.php file. It will give the role of the author the ability to upload files.
$user_role = ‘author’; // Change user role here
$contributor = get_role($user_role);
Hopefully either of above 2 will work for you. If none of them works, try this one. Try to add the full file path for the uploads directory under Settings > Media.
If neither of above works for you and you found fix from somewhere else, please do not forget to share with me via comment. I will add it here and it might help someone else like you.