Multiple File Uploads - Array Turning Out Nutty

From: Date: Thu, 06 Jul 2000 23:42:26 +0000
Subject: Multiple File Uploads - Array Turning Out Nutty
Groups: php.general 
Request: Send a blank email to php-general+get-5288@lists.php.net to get a copy of this message
Hello All, Thanks, Rasmus, for answering my last question. I've made tremendous progress today thanks to you! But I've hit another bug-like wall, and I'm hoping one of you can help me! I've got a FORM with three FILE UPLOAD elements. <INPUT TYPE="file" NAME="userfile[]"> After submitting three separate files (well under the 2MB limit), my userfile[] array looks like this according to phpinfo(): HTTP_POST_FILES["userfile"] Array (
    [0] => Array
        (
            [name] => link.sit.bin
        )
    [1] => Array
        (
            [type] => application/macbinary
        )
    [tmp_name] => /tmp/phpmtkplg
    [size] => 1236
    [2] => Array
        (
            [name] => link.jpg
        )
    [3] => Array
        (
            [type] => image/jpeg
        )
    [4] => Array
        (
            [name] => link-t.gif
        )
    [5] => Array
        (
            [type] => image/gif
        )
) First question: why is the tmp_name and size only being given for the first file? Second question, why is the size for the first file wrong? (It should be 200k; it's using the third file's size.) Third question: why doesn't this array match the documentation at all? :) Only $userfile is defined, not $userfile_name or $userfile_size, etc. I also hoped the array, according to the manual, was supposed to work kind of like this: Array ( [name] => Array { [0] => link.sit.bin [1] => link.jpg [2] => link-t.gif } [size] => Array { [0] => 256243 [1] => 3253 [...etc...] Based on the manual sentence "$userfile['name'][0], $userfile['tmp_name'][0], $userfile['size'][0], and $userfile['type'][0] are also set.". Thanks in advance for any help! Regards, Cabel Panic

« previous php.general (#5288) next »