[英]checking an image for size in php?
i want to check an images size thats already uploaded to the server: psuedocode 我想检查已上传到服务器的图像大小:psuedocode
if (checksize($image) >10mb {
die
}
can i do something like that in php? 我可以在php中做类似的事情吗? thanks :)_)
谢谢 :)_)
Assuming $image
is a path to a file somewhere on the filesystem: 假设
$image
是文件系统上某个文件的路径:
if(filesize($image) > (10 * 1024 * 1024)){ // is it larger than 10mb?
die('too big');
}
Here is the PHP documentation. 这是PHP文档。
http://php.net/manual/en/function.filesize.php http://php.net/manual/zh/function.filesize.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.