Inserting more than one array into same row

foreach loops over a single variable. Here you have two, so using foreach is not the right method. Or you’d have to add a $i index inside the loop to get the second variable. But there’s a simpler way:

$total = count($_POST['file_name']);

for($i = 0; $i < $total; $i++) {
    $file_name = $_POST['file_name'][$i];
    $file = $_POST['file'][$i];

    $wpdb->insert( 'table', array ('project_ref'=> $reference,'project_name'=>$file_name,'project_link'=>$file));
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)