From e3bf577eb033e85727235385b0ba35638942807b Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Thu, 31 Aug 2006 07:30:49 +0000 Subject: #80574 by Steven and chx. Fix file uploads. --- includes/form.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'includes/form.inc') diff --git a/includes/form.inc b/includes/form.inc index d5607d957..76779646e 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -547,7 +547,13 @@ function form_builder($form_id, $form) { if (!isset($form['#name'])) { $name = array_shift($form['#parents']); $form['#name'] = $name; - if (count($form['#parents'])) { + if ($form['#type'] == 'file') { + // to make it easier to handle $_FILES in file.inc, we place all + // file fields in the 'files' array. Also, we do not support + // nested file names + $form['#name'] = 'files['. $form['#name'] .']'; + } + elseif (count($form['#parents'])) { $form['#name'] .= '['. implode('][', $form['#parents']) .']'; } array_unshift($form['#parents'], $name); -- cgit v1.2.3