1
我想在檢查圖像大小,寬度和高度後上傳圖像,但我的腳本有錯誤。檢查大小,寬度和高度後上傳圖像
代碼:
<?php
include('dbcon.php');
$name=$_POST["name"];
$tel=$_POST["tel"];
//upload file syntax begining
$fileField=$_FILES["fileField"]["name"];
if($_FILES["fileField"]["size"] >= 50000) {
echo "bigfile";
}
elseif {
$fileField = @getimagesize($_FILES["fileField"]["tmp_name"]);
($fileField === FALSE || !($fileField[2] == IMAGETYPE_GIF || $fileField[2] == IMAGETYPE_JPEG || $fileField[2] == IMAGETYPE_PNG));
echo "Only Allow jpeg,PNG,Gif";
{
else{
move_uploaded_file($_FILES["fileField"]["tmp_name"],"upload/".$_FILES["fileField"]["name"]);
//upload file syntax ending
$sql="insert into imgtb(name,tel,image)values('$name','$tel','$fileField')";
$result=mysql_query($sql);
}
?>
有人請幫助修正錯誤!