Is there any way to use a variable in the actual $_FILES['file'] section? I am uploading multiple images that are not always uploaded. For example, I can update a potential of 1-4 images but want to be able to just upload #3 or #4 in an instance. Code is like this:
if($selectedimages != ''){
foreach ($selectedimages as $i){
$imagename = $productid."-".$i;
$imageid = "image_loc-".$imagename;
if($_FILES['$imageid']['name']!=''){
but it will not register the variable in the file for name, is there anyway to do this?
the other variables are definitely valid as I already checked them, the function is just dying at this step.
Yes:
if($_FILES[$imageid]['name']!=''){— just don’t use quotes and it won’t be treated as a literal.