Skip Navigation

[Résolu] Image upload only work if I’m logged into WordPress, otherwise I get an error.

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I try to upload an Image with a CRED form thru the front end as a guest. It fails with "There was an error uploading your file." I use the Toolset Access Plugin too.

Solution: If you use "Managed by Access" for Media, you can give the Guest only reading rights. Then it will fail to upload a media attachment.

If you use "Use the default WordPress read permissions" on the media post type, you can upload the images just fine as a Guest.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 4 réponses, has 2 voix.

Last updated by Tom Gonzales Il y a 3 années et 6 mois.

Assigned support staff: Beda.

Auteur
Publications
#609594
sample-image-upload-error.png

I am trying to: My client informed me that the image upload on one of the CRED form wasn't working, so I tested it and find that it only works from the frontend if I'm logged into WordPress. This is the message I get "There was an error uploading your file."

Link to a page where the issue can be seen: hidden link

This happened once before, but it was a file upload setting in my Firewall, but I've checked that and it's set to allow file uploads. I also disabled all my other non-Toolset plugins, cleared the browser cache, and it still didn't work.

#609692

On a clean WordPress instal I can upload images to a Types Image Field within a CRED Form just fine.

This is either an issue where custom code is applied to your CRED Form (validation or similar) or it's a issue with the Image itself (not supported, too big, similar)

What I need to help you solve the issue:
- the Image you try to upload
- a copy of your site
https://toolset.com/faq/provide-supporters-copy-site/

Thank you

#610135

The issue on your site seems related to the Toolset Access Plugin.

As soon I deactivate it, the upload works.

Obviously this is because your User (guest) has no edit rights on Media Post type in Toolset > Access.
If you use "Use the default WordPress read permissions" on the media post type, you can upload the images just fine as a Guest.

If you use "Managed by Access", you can give the Guest only reading rights.
Then it will fail to upload a media attachment.

I never control media with Access, it's usually not required.
But in the scenario you presented here, I see an issue popping up.
It should be possible to manipulate Access rights to media for guests, if it is actually possible for them to upload the images.

Either of both is wrong (a BUG) and I need to escalate this, after I make sure this also happens on a fresh install.

But for now, you can proceed with the above steps, if these are suitable for you?

#610163

Ok - I understand what you're saying, but how do I change the permissions for uploading media? I don't see any controls on Media in Access panel, only CRED forms access to View or not View for Guest.

Where do I make the change to allow frontend media uploads, without turning off Access Control for everything else?

Thanks!

#610273

Ok - never mind. I found the settings. For some reason I didn't see those options at the top of each control section last night when I looked. Probably needed to get some sleep. 😉

Thanks for the help!