I have a problem I just can't figure out the answer to.
I have a form that has a variable number of file upload fields depending upon user input. Uploading the files isn't the problem, but recording their names are.
Here is the code I use:
for($i=1;$i<$npictures;$i++)
{
$varname = "picture".$i;
$varname_name = "picture".$i."_name";
if(!$pic_array)
{
$pic_array = array($varname_name);
}
else
{
array_push ($pic_array, $varname_name);
}
if($$varname)
{
copy($$varname,$picturedir.$$varname_name);
}
}
It loops through to copy the images to the right spot and compile their names/location into the array so I can implode them later and submit them to the database.
But the array only seems to have one entry into it no matter how many pictures the user wants to upload, and the entry to the array is "picture1_name" but its supposed to be the actual name of the picture uploaded, not the name of the file upload field.
Please help!