WPCF7_Submission::add_uploaded_file()
Adds a file to the uploaded files array.
Метод класса: WPCF7_Submission{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_uploaded_file( $name, $file_path );
- $name(строка) (обязательный)
- Field name.
- $file_path(строка|массив) (обязательный)
- File path or array of file paths.
Код WPCF7_Submission::add_uploaded_file() WPCF7 Submission::add uploaded file CF7 5.9.8
private function add_uploaded_file( $name, $file_path ) { if ( ! wpcf7_is_name( $name ) ) { return false; } $paths = (array) $file_path; $uploaded_files = array(); $hash_strings = array(); foreach ( $paths as $path ) { if ( @is_file( $path ) and @is_readable( $path ) ) { $uploaded_files[] = $path; $hash_strings[] = md5_file( $path ); } } $this->uploaded_files[$name] = $uploaded_files; if ( empty( $this->posted_data[$name] ) ) { $this->posted_data[$name] = implode( ' ', $hash_strings ); } }