Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Thanked 27 Times in 26 Posts

    separating $_Files array

    I need to separate the $_FILES array when multiple upload groups are posted...ex: uploaded_images, uploaded_pdfs

    Currently I thinking of using:
    if(isset($_FILES['uploaded']) && !empty($_FILES['uploaded_images'])){
    for ($i = 0; $i < count($_FILES['uploaded_images']['name']); $i++) {
    $FileField = ($i+1);
    $File          = $_FILES['uploaded_images'];
    $File_Src      = $File['tmp_name'][$i];
    $File_Name     = $File['name'][$i];
    $File_BaseName = basename($File_Name);
    $File_Ext      = substr($File_BaseName, strrpos($File_BaseName, '.') + 1);
    $File_Size     = $File['size'][$i];
    list($File_Width, $File_Height) = getimagesize($File_Src);
    $File_Type     = $File['type'][$i];
    $File_Error    = $File['error'][$i];
    $EntryStr  = $File_Src.'|';
    $EntryStr .= $File_Name.'|';
    $EntryStr .= $File_BaseName.'|';
    $EntryStr .= $File_Ext.'|';
    $EntryStr .= $File_Size.'|';
    $EntryStr .= $$File_Width.'|';
    $EntryStr .= $File_Height.'|';
    $EntryStr .= $File_Type.'|';
    $EntryStr .= $File_Error.'|';
    uploaded_images[]= $EntryStr;
    }//[end forLoop]
    but seems like there should be an easier way. I need each file upload group array written like the EntryStr above.
    NO Limits!! DHCreationStation.com
    For projects using MediaTypes (MIMETypes) visit E-BAM.net -(updated weekly)

    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.

  2. #2
    New Coder
    Join Date
    Apr 2014
    Daytona Beach, FL
    Thanked 1 Time in 1 Post
    No thats how i would do it.

    You could try to expload the array and see what happens though. I havent ever had to deal with file uploading before but it looks like the $_FILE is an $_FILES['uploaded_images']

    Tell me what you get when you do this:
    if(isset($_FILES['uploaded']) && !empty($_FILES['uploaded_images'])){

    Tell me what you get and maybe ill be able to assist you from there.

  3. #3
    Senior Coder
    Join Date
    Sep 2010
    Thanked 275 Times in 275 Posts
    You just need to use conditional statements based on $_FILES['type'] because $_FILES is already a two dimensional array. A good deal of work depending on how many types you have, but unavoidable.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.

    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.


Posting Permissions

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