Support Forum
Support › MB Frontend Submission › Problems uploading images to media library
Members of my site enter their details through Frontend Submission.
I have problems uploading images, the error I get is that I am not authorised to attach files to this post (or something similar, the message is in Dutch).
I am facing this problem for the following field types: Single Image, Image Advanced, File Advanced.
I am not facing this problem for field types File Input and for Image Upload. Although the images end up in the WP media library, I'd like to give the option to choose an image that was uploaded before, next to uploading a new image.
I have installed the WP Users Media plugin, so that users can only see their own uploaded images.
Members have the rights of WP user role author.
As administrator, I am not ancountering any problems uploading media files.
Any suggestion?
If the author already have rights of author, can you try deactivating the WP Users Media plugin to check if the bug still happens?
The same error occurs.
Hi,
Can you please try this code in the docs, just to make sure your users have correct permission to upload images. Replace 'subscriber' in the snippet by your user role.
Hi Anh,
No, it doesn't make any difference. I have changed it as follows:
function mb_allow_author_uploads() {
if ( is_admin() ) {
return;
}
// Replace 'subscriber' with the required role to update, can also be contributor.
$author = get_role( 'author' );
$author->add_cap( 'upload_files' );
}
add_action( 'init', 'mb_allow_author_uploads' );
But same error message.
My users have the author role, so should be capable of uploading their own images anyway, right?
Update: I have installed the Frontier plugin (to add/edit the post in the frontend), and here it is allowed to upload images to the media library. But in ME Frontend Submission, it's not.
Same user.
Just for you to know. Hopefully this helps.
Hi, I've tested with lower role (subscriber) with the snippet above to allow it to upload images and it worked for me. Can you take a screenshot of the error? Or a screen record is perfect for debugging?
Hi Anh, I don't know why, but it's working now smoothly.
Strange..., but OK, I guess.
Can you close this issue?
Thanks