Php 分析错误:语法错误,意外的“{”
我正在尝试获取index.html以使用此脚本:Php 分析错误:语法错误,意外的“{”,php,if-statement,syntax-error,Php,If Statement,Syntax Error,我正在尝试获取index.html以使用此脚本: <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit"
<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Upload" />
</form>
在浏览了有关堆栈溢出的主题后,我一直试图通过添加/删除}来发现问题,但失败了。谁能告诉我怎么了?提前谢谢 你错过了一个收场机会
真的有点明显
<?php
if ((($_FILES["file"]["type"] == "audio/mp3")
|| ($_FILES["file"]["type"] == "audio/mp3"))
&& ($_FILES["file"]["size"] < 21000000)) {
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
} else {
echo ""; //another echo to display after upload is complete
if (file_exists("mp3/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "mp3/" . $_FILES["file"]["name"]);
//Below shows the link for the mp3
echo "http://www.Domain here" . "mp3/" . $_FILES["file"]["name"] . ""; //Only change domain here leave directory
}
}
} else {
echo "Extension not allowed"; //Error message here if it's to big or wrong extension
}
?>
Parse error: syntax error, unexpected '{' in /var/www/xxxx/test/upload.php on line 5
if ((($_FILES["file"]["type"] == "audio/mp3") //File type
|| ($_FILES["file"]["type"] == "audio/mp3"))
&& ($_FILES["file"]["size"] < 21000000)) //20MB File Size
{
<?php
if ((($_FILES["file"]["type"] == "audio/mp3")
|| ($_FILES["file"]["type"] == "audio/mp3"))
&& ($_FILES["file"]["size"] < 21000000)) {
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
} else {
echo ""; //another echo to display after upload is complete
if (file_exists("mp3/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "mp3/" . $_FILES["file"]["name"]);
//Below shows the link for the mp3
echo "http://www.Domain here" . "mp3/" . $_FILES["file"]["name"] . ""; //Only change domain here leave directory
}
}
} else {
echo "Extension not allowed"; //Error message here if it's to big or wrong extension
}
?>