I am trying to have users be able to upload their images to the site using a cred frontend form, but I'm getting a popup, "There was an error uploading your
file" every time.
When I am logged into the wordpress site, I am able to upload images with no problem, but visitors who are not logged in are getting this error.
My plugins are updated, I have tried going to this article from toolset.com (https://toolset.com/errata/upload-fails-wordpress-installed-directory/), but it
still did not solve my issue. The images are uploading to the default folder.
Wordpress version 4.9.6
Toolset Access 2.4.3.5
Toolset CRED 1.9.6.1
Toolset Types 2.2.23
Toolset Views 2.5.2
hidden link
Please help. Really appreciate.
Hi, please go to Toolset > Access Control > Post Types and check the settings for the Posts post type (it should be managed by Access) and the Media post type (it should be managed by Access and Guests should have Publish permissions).
If this configuration does not solve the problem, please try the following troubleshooting steps:
- Temporarily deactivate all plugins except Types, Views, Access, and CRED, and activate a default theme like Twenty Seventeen. Then test again.
- If the problem was resolved, reactivate your theme and other plugins one by one until the conflict is revealed
- If the problem was not resolved, I'll need to take a closer look.
Hi Christian,
Thank you for your quick response.
When I went to Toolset > Access Control > Post Types and check the settings for the "Shared Stories" custom post type, it's managed by Access. The 'Media' post type is managed by Access, but the Publish option for Guest is grey out & the tooltip has this message 'This option doesn't work for Guest'. Same for all the Custom Post type & the default Post type.
The only option for Guest is 'Read'.
I have a screenshot attached.
Are there any settings that I need to change before doing the steps above?
Thanks, Rose
I see, can you tell me more about the image upload? Is the issue appearing when Guests try to upload a custom field image, or when Guests try to insert an image into a post's content?
Hi Christian,
The form is created using the CRED form, and there is a custom upload field for visitors/guests to upload their image.
The issue is that every time when guest tries to upload their image on the front-end CRED form (hidden link), they're getting a popup, "There was an error uploading your file".
I have a CPT called "Shared Stories", and I have added custom fields to this Post type using the Toolset Post Fields. It includes a custom Image field (for the image upload in the front-end).
In the CRED Post form, I have inserted the CRED shortcode [cred_field field='share-a_photo' post='shared_story' value='' urlparam=''] which is the upload field for visitors / guests to upload thier image. Once submitted, the post should be marked as pending (which it is), and from the upload image field, it should be inserted into the custom Image field.
It's working when I am logged in, but for guest / visitors (not logged in), they are getting the popup error "There was an error uploading your file".
I am not sure what the issue is. Please help. Really appreciate.
Thanks
Okay thanks. Please add this code to your child theme's functions.php file to attempt to override guest permissions on this form:
add_action( 'admin_init','reset_guest_caps' ,9 );
function reset_guest_caps(){
global $current_user, $wpcf_access;
if(isset($_GET['formid']) && $_GET['formid']==12345&&$current_user->ID==0)
{
$wpcf_access->settings=array();
}
}
Replace 12345 with the numeric ID of this CRED form, and test again. Let me know the results and we can go from there.
Thank you so much Christian! It's working now for guests who are not logged in.
I really appreciate your help.
Thanks again!