简体   繁体   中英

checking an image for size in php?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM