This is my code to test for MySQL:
if (extension_loaded('mysqlnd')) {
echo "mysql supported";
} else {
echo "mysql not supported";
};
How can I check to see if uploads are allowed?
This is my code to test for MySQL:
if (extension_loaded('mysqlnd')) {
echo "mysql supported";
} else {
echo "mysql not supported";
};
How can I check to see if uploads are allowed?
if(ini_get('file_uploads') == 1)
{
echo 'HTTP Upload Enabled';
}
else
{
echo 'HTTP Upload Disabled';
}
PHP has the file_uploads
INI setting:
Whether or not to allow HTTP file uploads. See also the
upload_max_filesize
,upload_tmp_dir
, andpost_max_size
directives.
If you test that using ini_get()
, you should be able to detect whether file uploads are enabled. (Make sure you test this, though.)
Theoretically, setting upload_max_filesize
or post_max_size
to a very low value could effectively block uploads as well. Also, file uploads could also be blocked on web server level. That will be impossible for you to detect without actually trying to do an upload.
I dont think there's such thing like disabling file uploads and checking file upload support. You only can check things like, max allowed size, etc, like:
$maxSize = ini_get('post_max_size');
Hope it helps