Home Forums ACF PRO acf_form and allowed file types


acf_form and allowed file types

  • When you have restricted file types in a file field, ACF accepts them as uploads on the front-end and reports a file has been uploaded.

    Here’s the setup:
    front end acf_form on public page
    file field (not set as required)
    file field “type” is restricted (such as “PDF”)
    acf/save_post action in functions.php sends an e-mail notification

    Open form. Upload non-approved file type (such as “DOC”). Front end returns “success” page instead of validation error. Then, via acf/save_post action, get_field([file field], $post_id) returns something that evaluates to true.

    After that, correctly, ACF discards the file. It is not stored in WordPress’ media library.

    I think I know why this is happening, but it doesn’t seem like desired behavior.

  • Hi @hazard

    So basically the validation for allowed file types occurs too late when using a front-end form with acf_form()?

    Do you have the latest version of WP and ACF PRO?

  • Yes, that sounds like another good way to describe it.

    WP 4.3 and ACF Pro 5.3.0

  • Alright thanks.

    I’ll assign this topic to @Elliot so he’s notified of it.

  • Is this going to be fixed soon?

    Our image field gets the validation message in the post meta where the image should be.

  • I think this a problem with file validation in general.

    My form creates a new post in a custom post type. The file upload field is required. When a file with a non-approved format is uploaded, ACF does not save the information as a new post but does return a success message to the user, meaning they have no idea there’s anything wrong with it.

  • 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!


  • Thanks guys,

    I’ve added this one to my to-do but doesn’t sound like it will be an easy or simple fix


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

The topic ‘acf_form and allowed file types’ is closed to new replies.