为foreach()提供的无效参数!

can you help me to fix error.

Here's the line of my code which have an error:

$filename = str_replace(' ','-',$HTTP_POST_FILES['thumbimg']['name']);

if ($filename != "") {  

    $valid = 0;
    $temp = explode('.',$filename);
    $filetype = $temp[count($temp)];

    foreach ($imageFileType as $ext) {
        if ($filetype == $ext) {
            $valid = 1;
        }
    }

    if ($valid = 0) {
        $error .= "<li>File is not a valid image.</li>";
    }

    $filesize = str_replace($HTTP_POST_FILES['thumbimg']['size']);

    if ($error == "" ) {
        copy($HTTP_POST_FILES['thumbimg']['tmp_name'], $showPathAdmin.$sID.'/'.$filename);
        $query = "UPDATE `shows` SET `thumbnail` = '$filename' WHERE sID = '$sID' ";
        mysql_query($query) or die('Error, query failed'.mysql_error());
    }
}   

foreach($_POST['castdelete'] as $deletecast){

    unlink($showPathAdmin.$sID.'/'.$deletecast);

}