class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
$files = array(); foreach ($_FILES['my_field'] as $k => $l) { foreach ($l as $i => $v) { if (!array_key_exists($i, $files)) $files[$i] = array(); $files[$i][$k] = $v; echo $l; } } // we now remove invalid entries for non-uploaded images foreach ($files as $k => $v) { if ($v['error'] != 0) unset($files[$k]); } $uploaded = array(); foreach (array_keys($files) as $k) { //-> here name of image }