iterate through array and get pull out specific values
Results 1 to 2 of 2

Thread: iterate through array and get pull out specific values

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    21

    iterate through array and get pull out specific values

    Hello,

    I have script for multiple file uploads. Im trying to iterate through the array fiels to separate the "name" the the "tmp_name" from the array. I tried different variations with the foreach loop and I'm not getting the results i'm looking to get.

    Results I like to receive:
    orange.jpg /tmp/phpvvodB8
    postproject.jpg /tmp/php9pDM36


    Array: $testArray = $_FILES['data'];
    result:
    array(5) { ["name"]=> array(2) { [0]=> string(10) "orange.jpg" [1]=> string(15) "postproject.jpg" } ["type"]=> array(2) { [0]=> string(10) "image/jpeg" [1]=> string(10) "image/jpeg" } ["tmp_name"]=> array(2) { [0]=> string(14) "/tmp/phpvvodB8" [1]=> string(14) "/tmp/php9pDM36" } ["error"]=> array(2) { [0]=> int(0) [1]=> int(0) } ["size"]=> array(2) { [0]=> int(13748) [1]=> int(4511) } }

    PHP Code:
    foreach($testArray as $key1 => $value1)
    {    foreach(
    $value1 as $key2 => $value2)
        { echo 
    "<br> found " $value2; }

    any help you can provide would be greatly appreciated

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    See Example #3 on the PHP manual page for uploading files via the POST method (features.file-upload.post-method).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •