What are the potential pitfalls of implementing multi-upload in PHP using arrays?

One potential pitfall of implementing multi-upload in PHP using arrays is the risk of exceeding server memory limits when handling a large number of files. To mitigate this issue, you can process each file individually as it is uploaded, rather than storing them all in an array before processing.

if(isset($_FILES['files'])){
    $file_count = count($_FILES['files']['name']);
    
    for($i = 0; $i < $file_count; $i++){
        $file_name = $_FILES['files']['name'][$i];
        $file_tmp = $_FILES['files']['tmp_name'][$i];
        
        // Process the file here
        move_uploaded_file($file_tmp, "uploads/" . $file_name);
    }
}