Reply to Re: Multiple Upload: First file is uploaded but the rest is not uploaded

Re: Multiple Upload: First file is uploaded but the rest is not uploaded new!
by Brixter de Leon, 13 years ago
I fixed the problem.

Great script thanks for the hard work.
$files = array();
foreach ( $_FILES['images'] as $k => $l ) {
  foreach ( $l as $i => $v ) {
    //die( print_r( $_FILES, 1 ) );
    if ( ! array_key_exists( $i, $files ) )
      $files[$i] = array();
      $files[$i][$k] = $v;
  }
}
foreach ( $files as $get_files ) {
  $upload = new Upload( $get_files );
  $suffix = date( 'Y-m-d' ) . '_';
  $upload->mime_check = true;
  $upload->file_name_body_pre = $suffix;
  $upload->jpeg_quality = panadol_option( 'media_quality' );
  if ( $upload->uploaded ) {
    if ( panadol_option( 'media_watermark' ) == 'enabled' )  {
      /** Create watermark. */
      $upload->image_text = panadol_option( 'media_watermark_text' );
      $upload->image_text_font = panadol_option( 'media_watermark_text_size' );
      $upload->image_text_color = panadol_option( 'media_watermark_text_color' );
      $upload->image_text_position = 'BR';
      $upload->image_text_padding_x = 5;
      $upload->image_text_padding_y = 5;
    }
    $upload->Process( panadol_option( 'upload_path' ) );

    /** Create image thumbnail. */
    $image_is_allowed = $upload->allowed = array( 'image/*' );
    if ( $image_is_allowed ) {
      $upload->file_name_body_pre = $suffix;
      $upload->image_resize = true;
      $upload->image_ratio_crop = true;
      $upload->image_x = panadol_option( 'thumbnail_size_w' );
      $upload->image_y = panadol_option( 'thumbnail_size_h' );
      $upload->jpeg_quality = panadol_option( 'thumbnail_quality' );
      $upload->file_name_body_add = panadol_option( 'thumbnail_append' );
      $upload->Process( panadol_option( 'upload_path' ) );
    }
    $database = MEDIA_TBL;
    mysql_query( "INSERT INTO $database ( media_title, media_filename, media_title_uneditable, media_date, media_extension, media_type ) VALUES ( '$upload->file_dst_name_body', '$upload->file_dst_name', '$upload->file_dst_name_body', NOW(), '$upload->file_dst_name_ext', '$upload->file_src_mime' )" ) or die( panadol_database() );
  } elseif ( $upload->processed ) {
    header( 'Location: ' . panadol_sanitize( panadol_cleanurl( '?load=admin§ion=upload-a-media&save=success' ), 'htmlentity_decode' ) );
    exit;           
  } else {
    header( 'Location: ' . panadol_sanitize( panadol_cleanurl( '?load=admin§ion=upload-a-media&save=error' ), 'htmlentity_decode' ) );
    exit;
  }
  //die( $upload->log );
  $upload-> Clean();
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important