PHP - Uploading multiple files PHP - Uploading multiple files wordpress wordpress

PHP - Uploading multiple files


Try:

$files = $_FILES['image'];foreach ($files['name'] as $key => $value) {  if ($files['name'][$key]) {    $file = array(      'name'     => $files['name'][$key],      'type'     => $files['type'][$key],      'tmp_name' => $files['tmp_name'][$key],      'error'    => $files['error'][$key],      'size'     => $files['size'][$key]    );    wp_handle_upload($file);  }}


Couldn't you loop through your files array and then call the upload_handlers?

e.g.

for( $i = 1; $i <= count( $_FILES['image']['name']; $i++ ) {    // just cguessing on the args wp_handle_upload takes    wp_handle_upload( $_FILES['images']['tmp'][$i], $_FILES['images']['name'][$i] );}