```
function addFlyer($db) {
if (isset($_FILES['file_array'])) {
    $name_array = $_FILES['file_array']['name'];
    $tmp_name_array = $_FILES['file_array']['tmp_name'];
    $type_array = $_FILES['file_array']['type'];
    $size_array = $_FILES['file_array']['size'];
    $error_array = $_FILES['file_array']['error'];
    for ($i = 0; $i < count($tmp_name_array); $i++) {
        if (file_exists($name_array[$i])) {
            echo "Sorry file already exists. ";
            $uploadOk = 0;
        }
        else {
            if (move_uploaded_file($tmp_name_array[$i], "images/" . $name_array[$i])) {
                echo $name_array[$i] . " upload is complete<br>";
            } else {
                echo "move_uploaded_file function failed for " . $name_array[$i] . "<br>";
            }
        }
    }
}

```

At the moment I got this code for upload multiple files to a folder and insert it into the database (I excluded the code for inserting.)

But if I want to use the file\_exists function correctly I need to seperate the extension and the name from the file. But I have no idea how I can explode an array.

Is there someone that can help me with this?