我的数组有什么问题,我得到错误信息'array',这并没有说明它有什么问题。我看不出它有什么问题,它没有将图片上传到目标文件夹,只是希望有人可以帮助我。
<?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;
}
?>
答案 0 :(得分:0)
更改此行
echo "failed! ".error_get_last()."";
到
print_r(error_get_last());
答案 1 :(得分:0)
如果您回显数组,它将显示“数组”。如果您发出问题,我不会这样做,但您应该使用print_r()的var_dump()而不是echo。这些将显示数组的内容。