Horde_Browser::allowFileUploads PHP Méthode

allowFileUploads() public static méthode

Determines if files can be uploaded to the system.
public static allowFileUploads ( ) : integer
Résultat integer If uploads allowed, returns the maximum size of the upload in bytes. Returns 0 if uploads are not allowed.
    public static function allowFileUploads()
    {
        if (!ini_get('file_uploads') || ($dir = ini_get('upload_tmp_dir')) && !is_writable($dir)) {
            return 0;
        }
        $filesize = ini_get('upload_max_filesize');
        switch (Horde_String::lower(substr($filesize, -1, 1))) {
            case 'k':
                $filesize = intval(floatval($filesize) * 1024);
                break;
            case 'm':
                $filesize = intval(floatval($filesize) * 1024 * 1024);
                break;
            case 'g':
                $filesize = intval(floatval($filesize) * 1024 * 1024 * 1024);
                break;
            default:
                $filesize = intval($filesize);
                break;
        }
        $postsize = ini_get('post_max_size');
        switch (Horde_String::lower(substr($postsize, -1, 1))) {
            case 'k':
                $postsize = intval(floatval($postsize) * 1024);
                break;
            case 'm':
                $postsize = intval(floatval($postsize) * 1024 * 1024);
                break;
            case 'g':
                $postsize = intval(floatval($postsize) * 1024 * 1024 * 1024);
                break;
            default:
                $postsize = intval($postsize);
                break;
        }
        return min($filesize, $postsize);
    }