• // /main/frontend/fields/general/class-upload-file.php
    // Vaildate function does not returns anything when using basic(browser) uploader, and it always returns error
            function validate_file_value( $valid, $value, $field, $input ) {
                // bail early if empty
                if ( empty( $value ) ) {
                    return $valid;
                }
    
                // bail early if is numeric
                if ( is_numeric( $value ) ) {
                    return $valid;
                }
    
                if ( isset( $value['file'] ) ) {
                    if ( ! $value['file']
                        && ! $value['id']
                        && $field['required']
                    ) {
                        return sprintf( __( '%s value is required.', 'acf-frontend-form-element' ), $field['label'] );
                    } else {
                        return $valid;
                    }
                }
                return $valid;// Modification
            }

    Vaildate function does not returns anything when using basic(browser) uploader, and it always returns error

    We need to return $valid on end of function.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Basic(browser) uploader always returns error’ is closed to new replies.