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

时间:2017-01-19 02:29:52

标签: php html css mysql

你可以帮我解决错误吗?

这是我的代码中有错误的行:

$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);

}

0 个答案:

没有答案