php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47553 Problem with multi-dimensional $_FILES
Submitted: 2009-03-03 18:43 UTC Modified: 2009-03-05 13:03 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: david at olyeo dot co dot uk Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2CVS-2009-03-03 (snap) OS: Ubuntu 8.04
Private report: No CVE-ID: None
 [2009-03-03 18:43 UTC] david at olyeo dot co dot uk
Description:
------------
Hi,

I am just working with multi-dimensional file uploads and they are not coming out as expected, i.e. they are not coming out the same as a single file upload. I don't see why this should be - why not just output all file upload in the same way?

Reproduce code:
---------------
I am using a form that has these fields:

<input type="file" name="submission[screenshot]" />
<input type="file" name="other[dem][][img][]" />

I am deliberately using multiple-depths as I am building an automatic form handler that will be able to handle any form.

Expected result:
----------------
'submission' => array
(
	'screenshot' => array
	'name' => 'monster_wallpaper.jpg'
	'type' => 'image/jpeg'
	'tmp_name' => '/tmp/php48lX2Y'
	'error' => 0
	'size' => 223262
),
'other' => array
(
	'dem' => array
		(
			'0' => array
				(
					'img' => array
						(
							'0' => 'mood_wallpaper.png'
							'type' => 'image/png'
							'tmp_name' => '/tmp/phpLotX1Q'
							'error' => 0
							'size' => 27809
						),

				),

		),
)

Actual result:
--------------
array(
    'submission' => array
        (
            'name' => array
                (
                    'screenshot' => 'monster_wallpaper.jpg'
                ),

            'type' => array
                (
                    'screenshot' => 'image/jpeg'
                ),

            'tmp_name' => array
                (
                    'screenshot' => '/tmp/php48lX2Y'
                ),

            'error' => array
                (
                    'screenshot' => 0
                ),

            'size' => array
                (
                    'screenshot' => 223262
                ),

        ),

    'other' => array
        (
            'name' => array
                (
                    'dem' => array
                        (
                            '0' => array
                                (
                                    'img' => array
                                        (
                                            '0' => 'mood_wallpaper.png'
                                        ),

                                ),

                        ),

                ),

            'type' => array
                (
                    'dem' => array
                        (
                            '0' => array
                                (
                                    'img' => array
                                        (
                                            '0' => 'image/png'
                                        ),

                                ),

                        ),

                ),

            'tmp_name' => array
                (
                    'dem' => array
                        (
                            '0' => array
                                (
                                    'img' => array
                                        (
                                            '0' => '/tmp/phpLotX1Q'
                                        ),

                                ),

                        ),

                ),

            'error' => array
                (
                    'dem' => array
                        (
                            '0' => array
                                (
                                    'img' => array
                                        (
                                            '0' => 0
                                        ),

                                ),

                        ),

                ),

            'size' => array
                (
                    'dem' => array
                        (
                            '0' => array
                                (
                                    'img' => array
                                        (
                                            '0' => 27809
                                        ),

                                ),

                        ),

                ),

        ),

);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-05 13:03 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 06:01:34 2024 UTC