Upload::format_multiple_files( array $file_post )
Description #
Format $_FILES field which have multiple files.
Parameters #
- $file_postarray (Required) single $_FILE field.
Source #
File: lib/form/class-upload.php
private function format_multiple_files( $file_post ) { if ( ! is_array( $file_post['name'] ) ) { return $file_post; } $file_ary = array(); $file_count = count( $file_post['name'] ); $file_keys = array_keys( $file_post ); for ( $i = 0; $i < $file_count; $i++ ) { foreach ( $file_keys as $key ) { $file_ary[ $i ][ $key ] = $file_post[ $key ][ $i ]; } } return array_filter( $file_ary, function ( $a ) { return ! empty( $a['name'] ); } ); }
Expand full source code Collapse full source code View on GitHub: lib/form/class-upload.php:155
Add your comment