开发者

checking an image for size in php?

开发者 https://www.devze.com 2023-02-03 01:17 出处:网络
i want to check an images size thats already uploaded to the server: psuedocode if (checksize($image) >10mb {

i want to check an images size thats already uploaded to the server: psuedocode

if (checksize($image) >10mb {

die

}

can开发者_运维问答 i do something like that in php? thanks :)_)


Assuming $image is a path to a file somewhere on the filesystem:

if(filesize($image) > (10 * 1024 * 1024)){  // is it larger than 10mb?
   die('too big');
}


Here is the PHP documentation.

http://php.net/manual/en/function.filesize.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号