Multiple image upload in wordpress -


i want upload multiple images using wordpress.

here code using single upload

 if ( ! function_exists( 'wp_handle_upload' ) )    require_once( abspath . 'wp-admin/includes/file.php' );  $uploadedfile = $_files['photo'];  $upload_overrides = array( 'test_form' => false );  $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );     if ( $movefile ) {      echo "file valid, , uploaded.\n";      var_dump( $movefile);     }   else {      echo "possible file upload attack!\n";     } 

how can upload multiple images using wordpress?

try implement this:

 $files = $_files['photo'];     foreach ($files['photo'] $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);       }     } 

Comments