uploading a variable number of files

Discussion in 'PHP' started by VFPGURU, Sep 13, 2010.

  1. #1
    Hello all;
    I have a form with a variable amount of upload controls on it. (the names of the objects are license1upload1, license1upload2, license2upload1, etc) I am able to create a form with one upload control and upload the file without a problem(without using variable names)... however when I throw the variables in the loop thats where the problem starts! here is what I have the problem with:
    ****************************************************
    FOR($x=1; $x<=$max_num_licenses; $x++)
    {
    FOR($y=1; $y<=$max_num_license_transcripts; $y++)
    {
    $thisfilename = "license".$x."upload".$y;
    if (($_FILES[$thisfilename]["type"] == "application/msword")
    || ($_FILES[$thisfilename]["type"] == "text/plain")
    || ($_FILES[$thisfilename]["type"] == "application/pdf" )
    || ($_FILES[$thisfilename]["type"] == "text/richtext" )
    && ($_FILES[$thisfilename]["size"] < 2048)) //2mb
    {
    $upload_file_name = "l_".$_SESSION['ssn'].'_'.$x.'_'.$y.substr($_FILES[$thisfilename]["name"], -4);
    move_uploaded_file($_FILES[$thisfilename]["tmp_name"],"C:/inetpub/wwwroot/uploadedfiles/" . $upload_file_name);
    }
    }
    }
    *****************************************************************
    the problem is that when I do select a file to upload, nothing happens when the form is processed. I can select the same file to upload using a form that has an upload control which doesnt use any variables in the name or ID for the object and it uploads without a problem. could the problem be with passing the variable $thisfilename ?? if so, how should I pass the variable? being that the code is in php, I didnt think that I needed to use the <?php ?> to pass the value... im lost, any help out there?
    Thanks in advance
     
    VFPGURU, Sep 13, 2010 IP