get image size before upload image php

前端 未结 4 1947
余生分开走
余生分开走 2021-01-25 08:36

I want to know the image size in mb but before ulpload do the same. I have:

$errors =       array();
$image =        $_FILES[\'image\'][\'name\'];
$file_tmp =            


        
4条回答
  •  故里飘歌
    2021-01-25 09:15

    Use php filesize function.You can get the bytes of the file

    $imgsize = filesize( '/home/projects/site/1.jpg' ); 
    

提交回复
热议问题