Server IP : 172.67.216.182 / Your IP : 172.70.188.20 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/coircraft.com/wp-content/plugins/caldera-forms/fields/advanced_file/ |
Upload File : |
<?php $is_multiple = null; if( !empty( $field['config']['multi_upload'] ) ){ $is_multiple .= ' multiple="multiple"'; } $uniqu_code = Caldera_Forms_Field_Util::generate_file_field_unique_id($field,$form); $required_check = ''; if( $field_required !== null ){ $required_check = 'required="required"'; $field_required = null; $is_multiple .= ' data-required="true"'; } if( empty( $field['config']['multi_upload_text'] ) ){ $field['config']['multi_upload_text'] = __( 'Add File', 'caldera-forms' ); if( !empty( $field['config']['multi_upload'] ) ){ $field['config']['multi_upload_text'] = __( 'Add Files', 'caldera-forms' ); } } //Set allowed types $accept_tag = array(); if( !empty( $field['config']['allowed'] ) ){ $allowed = array_map('trim', explode(',', trim( $field['config']['allowed'] ) ) ); $field['config']['allowed'] = array(); foreach( $allowed as $ext ){ $ext = trim( $ext, '.' ); $file_type = wp_check_filetype( 'tmp.'. $ext ); $field['config']['allowed'][] = $file_type['type']; $field['config']['allowed'][] = $file_type['ext']; $accept_tag[] = '.' . $ext; } }else{ $allowed = get_allowed_mime_types(); $field['config']['allowed'] = array(); foreach( $allowed as $ext=>$mime ){ $field['config']['allowed'][] = $mime; $accept_tag[] = '.' . str_replace('|', ',.', $ext ); } } //Fix allowed types // @see https://github.com/CalderaWP/Caldera-Forms/issues/2471 if ( ! empty( $field['config']['allowed'] )) { if (in_array('audio/mpeg', $field['config']['allowed'])) { $field['config']['allowed'][] = 'audio/mp3'; } $field['config']['allowed'] = array_unique($field['config']['allowed']); } if (! empty( $accept_tag)) { $accept_tag = array_unique($accept_tag); } $accept_tag = 'accept="' . esc_attr( implode(',', $accept_tag) ) . '"'; $field['config']['max_size'] = wp_max_upload_size(); $field['config']['notices'] = array( 'file_exceeds_size_limit' => esc_html__( 'File exceeds the maximum upload size for this site.', 'caldera-forms' ), 'zero_byte_file' => esc_html__( 'This file is empty. Please try another.', 'caldera-forms' ), 'invalid_filetype' => esc_html__( 'This file type is not allowed. Please try another.', 'caldera-forms' ), ); ?><?php echo $wrapper_before; ?> <?php echo $field_label; ?> <?php echo $field_before; ?> <div id="<?php echo esc_attr($field_id); ?>_file_list" data-id="<?php echo esc_attr($field_id); ?>" data-field="<?php echo esc_attr($field_base_id); ?>" class="cf-multi-uploader-list" ></div> <button id="<?php echo esc_attr($field_id); ?>_trigger" type="button" class="btn btn-block cf-uploader-trigger" data-parent="<?php echo esc_attr($field_id); ?>" > <?php echo esc_html($field['config']['multi_upload_text']); ?> </button> <input style="display:none;" <?php echo $accept_tag; ?> class="cf-multi-uploader" data-config="<?php echo esc_attr(json_encode($field['config'])); ?>" data-controlid="<?php echo esc_attr($uniqu_code); ?>" <?php echo $field_placeholder; ?> <?php echo $is_multiple; ?> type="file" data-field="<?php echo esc_attr($field_base_id); ?>" id="<?php echo esc_attr($field_id); ?>" name="<?php echo esc_attr($field_name); ?>" <?php echo $field_required; ?>> <input style="display:none;" type="text" id="<?php echo esc_attr($field_id); ?>_validator" data-field="<?php echo esc_attr($field_base_id); ?>" data-parsley-file-type="true" <?php echo $required_check; if ($required_check) : echo 'data-required="true"'; endif; ?> > <input type="hidden" name="<?php echo esc_attr($field_name); ?>" value="<?php echo esc_attr($uniqu_code); ?>" > <?php echo $field_caption; ?> <?php echo $field_after; ?> <?php echo $wrapper_after; ?>