To get the maximum file size allowed for uploading in PHP, you can use the ini_get
function with the upload_max_filesize
option. This will return the value of the configuration directive in bytes. You can then convert the bytes to the desired format (e.g. KB, MB, GB).
Here's an example code snippet that gets the upload_max_filesize value in bytes:
main.php392 chars17 lines
In the above code, the return_bytes
function is used to convert the file size value to bytes. It checks for the last character of the string (e.g. "M" for megabytes) and multiplies the size accordingly.
gistlibby LogSnag