I'm working with $_FILES
and sometimes the array has empty array elements due to empty file inputs on my form. I'm trying to unset these elements.
I've tried these code snippets:
foreach($_FILES['images']['name'] as $image)
{
if(empty($image))
{
unset($image);
}
}
foreach($_FILES['images']['name'] as $image)
{
if($image == "")
{
unset($image);
}
}
foreach($_FILES['images']['name'] as $image)
{
if(!$image)
{
unset($image);
}
}
But the array always comes back with empty elements. Is there actually a sane way of deleting empty $_FILES array elements with PHP?