我需要帮助。我有这个代码在我编辑文本时工作正常,但是当我去上传任何图像时它会给我错误。谁能告诉我我做错了什么?
<div id="page_file">
<form method="post" enctype="multipart/form-data">
<div id="img_upload">
<input type="file" name="image10" class="image"/>
<p><span>Note:</span>Image resolution should be exactly 700(width)*500(height) pixels.</p>
</div><!-- img_upload -->
<input type="submit" name="upload10" class="btn" value="upload"/>
</form>
<?php
if (isset($_POST['upload10'])) {
$category_id = 410;
$exe = end(explode(".", basename($_FILES['image10']['name'])));
$type = $_FILES['image10']['type'];
$temp = $_FILES['image10']['tmp_name'];
$size = $_FILES['image10']['size'];
$random = rand(1000, 9999);
$image_id = "img_" . $page_id . $category_id . "_" . $random;
$name = $image_id . "." . $exe;
$path = I_UPLOADPATH . $name;
$img_size = getimagesize($temp);
$width = $img_size[0];
$height = $img_size[1];
$extension = array(
"image/jpeg",
"image/jpg",
"image/png",
"image/gif"
);
if (in_array($type, $extension)) {
if (($width == 700) && ($height == 500)) {
if (move_uploaded_file($temp, $path)) {
$insert = "insert into gallery set srno='', image_id = '" . $image_id . "', title ='" . $name . "', page_id = '" . $page_id . "', category_id = '" . $category_id . "'";
$execute = mysql_query($insert);
if (!$execute) {
echo "Data Not Procced.....";
exit;
} else {
// echo "<script type='text/javascript'>window.alert('Upload Successfully.....');</script>";
echo ("<script>location.href = 'work.php';</script>");
}
} else {
echo "Error in Upload Image";
}
} else {
echo "You can Upload only 700 * 500 px Image Only";
}
} else {
echo "You can Upload only .JPG, .PNG, .GIF Image.....";
}
}
?>
</div>
这是代码的一部分,通常应该有效,但显示图像上传错误。