From 2648708b578aa5a632c7561f77bae458407d6454 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Mon, 21 Nov 2011 14:39:38 +0100 Subject: [PATCH] Add multi-file upload to bug reporting page Fixes #5228 --- bug_report.php | 14 +++++++++++--- bug_report_page.php | 24 +++++++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/bug_report.php b/bug_report.php index b87ce60777..e451ff8794 100644 --- a/bug_report.php +++ b/bug_report.php @@ -85,7 +85,7 @@ $t_bug_data->due_date = date_get_null(); } - $f_file = gpc_get_file( 'file', null ); /** @todo (thraxisp) Note that this always returns a structure */ + $f_files = gpc_get_file( 'ufile', null ); /** @todo (thraxisp) Note that this always returns a structure */ $f_report_stay = gpc_get_bool( 'report_stay', false ); $f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false); $f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false); @@ -142,8 +142,16 @@ last_visited_issue( $t_bug_id ); # Handle the file upload - if ( !is_blank( $f_file['tmp_name'] ) && ( 0 < $f_file['size'] ) ) { - file_add( $t_bug_id, $f_file, 'bug' ); + for( $i = 0; $i < count( $f_files ); $i++ ) { + if( !empty( $f_files['name'][$i] ) ) { + $t_file['name'] = $f_files['name'][$i]; + $t_file['tmp_name'] = $f_files['tmp_name'][$i]; + $t_file['type'] = $f_files['type'][$i]; + $t_file['error'] = $f_files['error'][$i]; + $t_file['size'] = $f_files['size'][$i]; + + file_add( $t_bug_id, $t_file, 'bug' ); + } } # Handle custom field submission diff --git a/bug_report_page.php b/bug_report_page.php index 06b2e7741c..18f1b7a0c9 100644 --- a/bug_report_page.php +++ b/bug_report_page.php @@ -479,8 +479,11 @@ } } # foreach( $t_related_custom_field_ids as $t_id ) ?> - > @@ -489,12 +492,23 @@ - name="file" type="file" size="60" /> - - + + 1 ) { + echo '
'; + } + } } +?> + + + + >