我要限制一個圖片150*130px 但是我的判斷式無法判斷,為何?

============upload_home.php===================================
<meta charset='utf8'>
<form name=\"form1\" action=\"upload_processor.php\" method=\"POST\" enctype=\"multipart/form-data\">
<input type=\"file\" name=\"file\" >
<input type=\"submit\" value =\"upfile\" name=\"submit\">
<input type=\"reset\" value=\"home\" >
</form>

===========================================================
=====================upload_processor.php========================

<?php

if(isset($_POST[\"submit\"])
{
$filename=$_FILES[\"file\"][\"name\"];
$filetype=$_FILES[\"file\"][\"type\"];
$filesize=$_FILES[\"file\"][\"size\"];
echo'<br>filename:'.$filename;
echo'<br>filetype:'.$filetype;

$filetemp_name=$_FILES[\"file\"][\"tmp_name\"];
$size = getimagesize($filetemp_name);
$width = $size[0];
$heigh = $size[1];
echo$width.$heigh;
$limit_img=array('jpg' => 'image/jpeg','pnd' => 'image/pnd', 'gif' =>'image/gif');

if(array_search($filetype,$limit_img,true))
{
echo'<br>是圖檔';
if(imagefontwidth($width)&&imagefontheight($heigh)!=\"0\"){
if(imagefontwidth($width)<=\"150\"&&imagefontheight($heigh)<=\"130\")
{
echo'<br>正確格式150*130';
}
else
{
echo'<br>不是正確格式150*130';
}
}
else
{
echo\"圖片沒上傳\";
}

}
else
{
echo'不是圖檔';
}
}
else
{
echo'你沒有權限';
}
?>

==========================================================

評論

Sign In or Register to comment.