Evertime我加载了我得到的页面
在第19行的C:\ xampp \ htdocs \ ZeroWebsite \ uploadtest.php中解析错误:语法错误,意外')'
<html>
<head>
<title></title>
</head>
<body>
<form action="uploadtest.php" method="POST" enctype="multipart/form-data">
<input type="file" name="image"> <input type="submit" value="Upload">
</form>
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("dataimage") or die (mysql_error());
$file = $_FILES['image']['tmp_name']);
if (!isset($file))
echo "select an image";
else // this is my line 19
{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if ($image_size==FALSE)
echo "not a image.";
else
{
if (!$insert = mysql_query("INSERT INTO myimage VALUES ('','@image_name','$image')"))
echo "problem uploading image.";
else
{
$lastid = mysql_insert_id();
echo "image uploaded.<p /> Your image:<p />img src=uploadtest2.php?id=lastid>";
}
}
}?>
</body>
</html>
我在youtube上为这个指南提供资金我只想让它工作plzz告诉我该怎么做
答案 0 :(得分:2)
$file = $_FILES['image']['tmp_name']);
必须是
$file = $_FILES['image']['tmp_name'];
答案 1 :(得分:1)
更改
$file = $_FILES['image']['tmp_name']);
要
$file = $_FILES['image']['tmp_name'];
另外一个“)”是他们的。
答案 2 :(得分:1)
问题是$file = $_FILES['image']['tmp_name']);
。删除上一个)
,它可以正常工作。