-2
我想驗證PHP中的圖像數據類型和大小,但我不知道如何做到這一點。我到目前爲止驗證文本字段,但與圖像我需要一些指導。請有人協助?php數據驗證插入圖像
$post_cat = dataValidation($_POST['cat']);
$post_keywords = dataValidation($_POST['post_keywords']);
$post_author = dataValidation($_POST['post_author']);
function dataValidation($cleandata) {
$data = trim($cleandata);
$data = stripslashes($cleandata);
$data = htmlspecialchars($cleandata);
return $cleandata;
}
$post_image = imageValidate($_FILES['post_image'] ['name']);
$post_image_type = imageValidate($_FILES['post_image'] ['type'])
$post_image_tmp = imageValidate($_FILES['post_image'] ['tmp_name']);
$post_image_size = imageValidate($_FILES['post_image'] ['size']);
function imageValidate {
// validate image size and type here
}
非常感謝 p