我的数组有什么问题,我收到错误消息“数组”,这并没有说明它有什么问题。我看不出它有什么问题,它没有将图片上传到预期的文件夹,只是希望有人能帮助我。
<?php
$s = "-";
$sqlName=mysql_query("SELECT * FROM business WHERE email='$login_bus' LIMIT 1")or die
("Sorry we have a mysql error!");
$row=mysql_fetch_array($sqlName);$busID=$row["id"];$busName=$row["businessName"];
$upload_path = ''.$busName.'/productServiceImage/';
$valid_formats = array("jpg", "png", "jpeg", "JPG", "PNG", "JPEG");
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST");
{
$name = $_FILES['pro_serImage']['name'];
$size = $_FILES['pro_serImage']['size'];
if(strlen($name))
{
list($txt, $ext) = explode(".", $name);
if(in_array($ext, $valid_formats))
{
if($size<(1024*1024)) // Image size max 1 MB
{
$actual_image_name = time().$s.$busID.".".$ext;
$tmp = $_FILES['pro_serImage']['tmp_name'];
if(move_uploaded_file($tmp, $upload_path.$actual_image_name))
{
list($width, $height) = getimagesize(''.$upload_path.$actual_image_name.'');
mysql_query("UPDATE product_service SET image='$actual_image_name',
image_width='$width', image_height='$height' WHERE businessEmail='$login_bus' LIMIT
1")or die ("Sorry we have a mysql error!");
echo "<img src='/".$upload_path.$actual_image_name."'>";
}
else
echo "failed! ".error_get_last()."";
}
else
echo "Image file size max 1 MB!";
}
else
echo "Invalid file format!";
}
else
echo "Please select image!";
exit;
}
?>