PHP allows you to limit the size of uploaded files in a few ways.
First, if you have access to your php.ini file, you can add or edit a directive called upload_max_filesize in the file:
; Maximum allowed size for uploaded files. upload_max_filesize = 32M
Then, if a user tries to upload a file larger than this value (32 megabytes in this example), the file upload is cancelled and the corresponding error array element is set to UPLOAD_ERR_INI_SIZE.
You can check the size of an uploaded file manually and reject it if it's too large:
if ($_FILES[" photo" ][" size" ]> 10000) die(" File too big!" );