Thursday, 5 April 2018

php - Parse error: syntax error, unexpected T_STRING, expecting ']'




I am getting error on my site Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/kbccsystem/kbccsystem.php.xdomain.jp/public_html/register.php on line 69



My PHP code in FROM line 69 to 96 is:



$allowedformat = array("gif" , "jpeg", "jpg" , "png");
$temp = explode(".", $_FILES["img_path"]["name"]);
$extension = end($temp);


if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file]["size"] < 20000 )
&& in_array($extension, $allowedformat)) {

if(is_uploaded_file($_FILES["img_path"]["tmp_name"]))

{
if(move_uploaded_file($_FILES["img_path"]["tmp_name"], "shop_image/" .$_FILES["img_path"]["name"]))
{
chmod("shop_image/" .$_FILES["img_path"]["name"], 0644);
echo "アップロードしました。";
}else{
echo "ファイルをアップロードできませんでした。";
}
}else{
echo "ファイルが選択されていません。";

}
}
}


Start line is 69. Last line is line 96.



please help :)
thankyou.


Answer




The syntax highlighter shows your error. You're missing a quote around one of your array keys:



&& ($_FILES["file]["size"] < 20000 )
^^^^^
HERE


It should be:



   && ($_FILES["file"]["size"] < 20000 )


No comments:

Post a Comment

casting - Why wasn&#39;t Tobey Maguire in The Amazing Spider-Man? - Movies &amp; TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...