Support

Account

Forum Replies Created

  • Hello @acf-support,

    I have to come back to this issue again because of two reasons:

    1. The problem with the basic uploader and the code snippet you provided above is, that it only works, when a file has not been uploaded already. If, in any case, the user returns back to the form, leaves the upload-field unchanged, clicks the submit button again, the upload field returns an ID as value (the attachment ID of the file) instead of the path to the already uploaded file. So the validation of the file extension fails, because it’s not able to fetch the file.
    The upload-field is set to return the attachment url in the ACF-setup, not the ID.
    To work around this, I’m now checking whether the field value is an ID or a path via Regex and catch the file with “wp_get_attachment_url” if it’s an ID.

    2. If the user selects a file with a file size that is above the limit in the setup of that field, the front end form doesn’t spit out the validation error (File is too large). Instead it proceeds and redirects to the given URL in “return” parameter. Basically the same problem as with file extension checking.

    Gregor

  • Hey @acf-support,

    thanks so much for the quick reply! Yes, it helped and I submitted a new ticket 🙂

    Best,
    Gregor

  • Hey @acf-support ,

    thanks for the reply. The upload field is the following:

    
    {
        "key": "field_5793b50551910",
        "label": "Vereinssatzung",
        "name": "vereinssatzung",
        "type": "file",
        "instructions": "blabla",
        "required": 1,
        "conditional_logic": 0,
        "wrapper": {
            "width": "",
            "class": "",
            "id": ""
        },
        "return_format": "url",
        "library": "uploadedTo",
        "min_size": "",
        "max_size": 7,
        "mime_types": "jpg, jpeg, pdf"
    },
    

    The front end form is injected like this:

    
    $options = array(
    	    'post_id' => 'user_'.$current_user->ID,
    	    'field_groups' => array('group_5793afe65ba18'),
    	    'return' => get_permalink( get_page_by_path( 'anmeldung-datenfreigabe' ) ), 
    
    	    'submit_value' => 'Weiter', 
    
    	    'honeypot' => true
    	);
    acf_form($options);
    

    Again: I’m utilizing the basic uploader and save all the data to the user meta table. After I select a file with a disallowed file type and submit the form, the page is being redirected and no error is shown.

  • Same here. Happens with the “basic uploader” inside a front end form.

    I’m utilizing “acf/upload_prefilter” now to prevent the form to be saved and to catch any errors.

    But I haven’t figured out how to display the error messages in the front end after the page has loaded again.

    Any ideas?

  • Same here. Happens with the “basic uploader” inside a front end form. But instead of a post, I’m saving user meta values.

    1. File upload field is required.
    2. A file with a non-approved format is uploaded.
    3. Front end form is submitted and redirects to the URL defined inside the “return” parameter. User doesn’t know anything is wrong.

    I’m utilizing “acf/upload_prefilter” now to prevent the redirect, but haven’t figured out how to display the error messages in the front end after the page has loaded.

    The problem also seems to be related to this post.

    Any ideas?

    Thanks in advance!

    Gregor

Viewing 5 posts - 1 through 5 (of 5 total)