我有一个问题,如何检查图片的大小是否在1mb到4mb之间?
我做过这样的事,但它给我带来了一个错误:
<?php
if (($_FILES['pic']['size'][$k] > 1000000) && ($_FILES['pic']['size'][$k] < 4000000))
{ // do sth here }
?>
答案 0 :(得分:0)
$min_mb = 1;
$max_mb = 4;
if($_FILES['pic']['size'] > ($min_mb * 1000 * 1000) && $_FILES['pic']['size'] < ($max_mb * 1000 * 1000))
{
//This image falls between the min and max successfully
}