I have created a script and as part of the script i want the script to detect the upload_max_filesize which is set in the web servers php.ini file. It will be displayed on the file upload webpage which is accessible to admins only.
Now at the moment i am using:
# Warn user the max filesize $SiteInfoMessages = '<b>Note:</b> <br /> We have detected that <b>your</b> web host does not allow you to upload any file greater than <b>' . ini_get('upload_max_filesize') . '</b>. If you try and upload a file larger than <b>'. ini_get('upload_max_filesize') .'</b>; the upload will fail.'; # display max filesize echo $SiteInfoMessages;
As my script is going to be freely shared i want to know will this work on all web hosts and windows hosting? obviously php has to be installed but heard that web hosts can block the checking of a php.ini file. If i am likely to have problems with this with some webhosts can anyone recommend how would i go about detecting the upload_max_filesize in the php.ini file.
I was thinking of an if statement but not sure how the condition would be written as not sure what php function would do the trick plus not sure if i would have any problems with the above code on some web hosts.
Thanks for any help/suggestions.